...

View Full Version : Floating 2 <li> items on opposite sides & one line, Win IE showing up incorrectly



babybackriib
01-07-2008, 08:04 PM
Hello,

I'm trying to create a nav menu on one line with 2 items: one on the left side and one on the right. It works correctly in Mac's Safari & Firefox and Windows Firefox: both items show up on the same line on opposite sides. But in Windows IE 6 or 7, the two items appear on the correct sides, but are on 2 lines.

I'm using images instead of text and they have rollovers. I have no idea why IE 6/7 is displaying the items on 2 lines and would appreciate any help. My CSS and HTML is below.

CSS

#header #secondary-nav { float: left; width: 100%; }

#header li#contact a, #header li#activities a { display: inline; height: 0; padding-top: 18px; overflow: hidden; background-repeat: no-repeat; background-position: 0 0; }

#header li#activities a { float: left; margin: 7px 0 7px 10px; background-image: url(../img/activities.gif); width: 125px; }

#header li#contact a { float: right; margin: 7px 10px 7px 0; background-image: url(../img/contact.gif); width: 177px; }

#header li#activities a:hover, #header li#contact a:hover { background-position: 0 -18px; }

HTML

<ul id="secondary-nav">
<li id="activities"><a href="/upcoming-activities/" title="Upcoming Activities">Upcoming Activities</a></li>
<li id="contact"><a href="/contact/" title="Contact">Contact</a></li>
</ul>

Thank you!

_Aerospace_Eng_
01-07-2008, 09:27 PM
Float the <li> to the left.

babybackriib
01-07-2008, 10:22 PM
Thanks!! I tried that before, but it didn't work because I removed the float from both links as well, so the code looked like this:


#header ul /* #secondary-nav */ { float: left; width: 100%; }

#header li#activities { float: left; }

#header li#contact { float: right; }

#header li#contact a, #header li#activities a { display: inline; height: 0; padding-top: 18px; overflow: hidden; background-repeat: no-repeat; background-position: 0 0; }

#header li#activities a { margin: 7px 0 7px 10px; background-image: url(../img/activities.gif); width: 125px; }

#header li#contact a { margin: 7px 10px 7px 0; background-image: url(../img/contact.gif); width: 177px; }

#header li#activities a:hover, #header li#contact a:hover { background-position: 0 -18px; }

When I removed the float from the links, they stayed in the correct places, but the text showed up and it displayed the entire image... and it did this in all the browsers. Strange. Well, thanks again! I really appreciate your help!



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum