Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    Oct 2007
    Posts
    10
    Thanks
    4
    Thanked 0 Times in 0 Posts

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

    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
    Code:
    #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
    Code:
    <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!

  • #2
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    Float the <li> to the left.
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • Users who have thanked _Aerospace_Eng_ for this post:

    babybackriib (01-08-2008)

  • #3
    New Coder
    Join Date
    Oct 2007
    Posts
    10
    Thanks
    4
    Thanked 0 Times in 0 Posts
    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:

    Code:
    #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!


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •