tags:

views:

136

answers:

3
.work .nav {
    list-style: none;
    margin: 0 0 5px 5px;
    padding: 0;
    position:absolute;
    top:248px;
    left:15px;
    z-index: 2;
}
.work .nav:after {
    content: ".";
    display: block;
    height: 0;
    clear: both;
    visibility: hidden;
}
.work .nav li {
    float: left;
    margin-right: 5px;
}
.work .nav li a {
    float: left;
    display: block;
    padding-top: 10px;
    width: 10px;
    height: 0;
    border: 1px solid #ccc;
    overflow: hidden;
}
.work .nav li a:hover {
    background: #bbb;
}
.work .nav li a.on {
    background: #ccc;
}

This is how it looks in Firefox and Internet Explorer. it looks perfect in Firefox but in IE it is messing up.

How can i fix this problem?

Thank you all.

A: 

A possible fix (works for me in IE8 and Firefox 3) is to remove the padding-top and change it to height:10px, then make the text colour the same as the background, e.g.:

.work .nav li a {
    float: left;
    display: block;
    width: 10px;
    height: 10px;
    border: 1px solid #ccc;
    color:#fff;
    overflow: hidden;
}

.work .nav li a:hover {
    background: #bbb;
    color:#bbb;
}
.work .nav li a.on {
    background: #ccc;
    color:#ccc;
}

(edit: for the HTML I used:

<div class="work">
<ul class="nav">
 <li><a href="">1</a></li>
 <li><a href="">2</a></li>
 <li><a href="">3</a></li>
</ul>
</div>

)

Alistair Knock
thank you very much. this worked for me in ie 7 but in ie8 nothing changed.
bboran
Works OK for me in IE8 with/without compatibility mode using your HTML and the combined CSS. Are you sure the old CSS hasn't been cached? (Ctrl-F5)
Alistair Knock
yes i am sure. this is very weird.
bboran
Try making a test page with only the HTML you posted above and the combined CSS posted above, see if that works. It may be something else on your page is influencing layout.
Alistair Knock
ohh thank you very much . i was using a wrong ie condition code that was not working on ie 8 =) now the code works great both in ie 7 and 8. thanks alot. i am new in here so i cant give vote sorry.
bboran
A: 

Change the following piece of CSS:

.work .nav li {
    float: left;
    margin-right: 5px;
    height: 10px;
    line-height: 0px;
}

This will make it behave correctly, although I didn't have IE8 handy to test. I used &nbsp; for the contents of the link.

CtlAltDel
thanks but still no change on ie 8
bboran
You might have to add text-decoration: none; for the a as well to hide the underline.
CtlAltDel
A: 

Using your CSS and Alistair Knock's HTML, I was able to replicate the the problem by putting IE (IE8 and IE8 in IE7 mode) into quirks mode. It rendered fine in standards mode which makes me think you could solve your problem by including a valid DOCTYPE in your HTML.

I used the IE Developer Toolbar to switch between quirks and standards mode (as well as IE8 and IE7 mode). It comes in very handy.

pw