November 12, 200917 yr Hi, I've built the following navigation inline navigation menu. But I'm puzzled why the text seems centred in each link - as if I've set the left padding to 30px or something. I want the first list item to align to the left of the navigation div. Here's the code if anyone can help. HTML: <div id="navigation"> <ul> <li class="Home"><a href="#"> home </a></li> <li class="Our Services"><a href="#">market assist</a></li> <li class="Our Approach"><a href="#">renewal manager</a></li> <li class="Our Team"><a href="#">loyalty builder </a></li> <li class="Analysis Wheel"><a href="#">reporting</a></li> <li class="Contact"><a href="#"> toolkit </a></li> </ul> </div> CSS: #navigation { position: absolute; top: 100px; left: 0px; height: 18px; width:900px; border-top: 1px dashed #666666; border-right: 0px solid #FFFFFF; border-bottom: 1px dashed #666666; border-left: 0px solid #FFFFFF; padding: 3px 30px 3px 3px; font-family: Arial, Helvetica, sans-serif; font-size: .75em; text-align::left; } #navigation ul { list-style: none; text-align:left; margin: 0; } #navigation li { display: inline; text-align::left; } #navigation a:link, #navigation a:visited { color: #000000; text-decoration: none; text-align:left; border: 0px;; padding: 18px 30px 18px 0px; } #navigation a:hover { padding: 18px 30px 18px 0px; color: #1880B4; border:0px; } Thanks!
November 12, 200917 yr They are left-aligned. Add padding: 0; to ul and backgrounds and you will see what's happening (IE7 was OK but Firefox was setting the first li tag to the right because of default padding):- #navigation ul { padding: 0; background: pink; list-style: none; text-align:left; margin: 0; } #navigation li { background: lime; display: inline; text-align::left; } #navigation a:link, #navigation a:visited { background: yellow; color: #000000; text-decoration: none; text-align:left; border: 0px;; padding: 18px 30px 18px 0px; } Note also that the top and bottom padding of 18px is a lot more than the ul and li tags need (Firefox shows the a tags extending above and below the ul and li tags).
November 12, 200917 yr Author Brilliant. Thanks vv much. Such a simple but extremely useful way of showing where I was going wrong using background colours. Why didn't I think of that!!? Anyway, onwards and upwards. Jo
Create an account or sign in to comment