tags:

views:

34

answers:

3

Hello I have 3 flags (Italian, german, english) with the purpose to change language for the whole site in future. How can I make a border on a hover effect that could alxo work with IE ?

this is the CCS

.miniflags {
    float:right
    margin : 5px 20px;
    padding-right:10px;
}

and here the HTML

<div id="bandiere">
    <a><img src="ita.png" class="miniflags" /></a>
    <a><img src="ger.png" class="miniflags" /></a>
    <a><img src="eng.png" class="miniflags" /></a>
</div>

Thanx for help

Alex

+2  A: 

If you apply the miniflags class to the <a> instead, the :hover pseudoselector will work.

The miniflags class hardly seems necessary. Just remember that :hover works only for links in older versions of IE, so you will need to apply it to the <a> tags instead of the <img>.

<div id="bandiere">
    <a><img src="ita.png" /></a>
    <a><img src="ger.png" /></a>
    <a><img src="eng.png" /></a>
</div>

<style type="text/css">
    #bandiere img {
        float:right
        margin : 5px 20px;
        padding-right:10px;
    }

    #bandiere a:hover, #bandiere a:focus {
        border: 1px solid red;
    }
</style>
Matchu
Thanx very helpull and easy !
Alpan67
The first version works with the .miniflags class; the last version without the class moves all the DIV id=bandiere
Alpan67
Ahh. If `.miniflags` appears in other locations, then you'll need to reapply it. But the `#bandiere a:hover` rule should still stand, unless you need to apply it to *links* outside of this particular div, as well.
Matchu
Many people use the mouse, some (must) use a keyboard: for each CSS rule with a :hover selector, you should always add the same selector with :focus instead of :hover, that is: "#bandiere a:hover, #bandiere a:focus { /* */ }
Felipe Alsacreations
@Felipe Alsacreations: True! Edited.
Matchu
+1  A: 

IE (until 6 IIRC) only allows hover for links. So you'd have to add the :hover to the a not to the image. The <a> must have a href attribute for this to work of course.

Marian
+2  A: 

add

.miniflags img:hover {
    border: 1px solid #000;
}

or

.miniflags a:hover {
    border: 1px solid #000;
}

to your css

i believe the 2nd will work better (a:hover)

TankDriver