Forum Moderators: not2easy
such as:
<ul class="hmenu" id="ultmenu">
<li class="hmenu_left"><a href="#home" class="topLink">1</a></li>
<li class="hmenu_mid"><a href="#about" class="topLink">Who is</a></li>
<li class="hmenu_mid"><a href="#offers" class="topLink">Our Offerings</a></li>
<li class="hmenu_right"><a href="#contactus" class="topLink">Hello</a></li>
</ul>
the problem is the background is on the li tag, and when there is no link involved, it displays perfectly with paddings and margins. however when i use the link it shrinks to only the links space and paddings totally mess everything up.
can some1 please help?
Before you get too deep into this, you also might change your approach: you use class for elements that may be used in many places on the page, and id for unique elements. Most of your classes should be ID's, and you can also reference many of them with fewer selectors. Like so:
#ultmenu { padding:0; margin:0; }
/* note that display inline on the li would make it a horizontal nav */
#ultmenu li {
padding:0;
margin:0;
list-style:none;
display:inline;
}
#ultmenu li a {
display:block;
padding:9px;
background:url(/images/nav-bg.gif) top left repeat-x;
}
#ultmenu #hmenu_left a { }
#ultmenu .hmenu_mid a { }
#ultmenu #hmenu_right a { }
Note that because hmenu_mid is used twice, a class is appropriate.
<ul id="ultmenu">
<li id="hmenu_left"><a href="#home">1</a></li>
<li class="hmenu_mid"><a href="#about">Who is</a></li>
<li class="hmenu_mid"><a href="#offers">Our Offerings</a></li>
<li id="hmenu_right"><a href="#contactus">Hello</a></li>
</ul>