Hi there,
I created a horizontal CSS menu using HTML lists.
i.e
<ul id="navigation">
<li id="youarehere"><a href="#">Home</a></li>
<li><a href="#">Home</a></li>
<li><a href="#">About Us</a></li>
</ul>
ect...
Everything works as it should, expect when you hover over the links. You see, I created a bold hover state for the links, and now the menu links shift because of the bold size difference.
I've searched everywhere for a solution, and can't find one. Surely, I can't be the only one trying to do this.
http://www.sitepoint.com/forums/showthread.php?t=593181
I encounter the same problem as the post above. However, the post does not have proper solution. Does anyone have any ideas?
P.S: I don't know the width of text in menu and so I cannot just set the width of li.
This is my code:
HTML:
<ul class="nav">
<li class="first"><a href="#">item 0</a></li>
<li><a href="#">item 1</a></li>
<li><a href="#">item 2</a></li>
<li><a href="#">item 3</a></li>
<li><a href="#">item 4</a></li>
</ul>
CSS:
.nav { margin:0; padding:0; }
.nav li { list-style:none; display:inline; border-left: #ffffff 1px solid}
.nav li a:link, .nav li a:visited { text-decoration:none; color:#ffffff; margin-left:8px; margin-right:5px;}
.nav li a:hover{ text-decoration:none; font-weight:bold; }
.nav li.first {border:none;}