guy4graphics
asked on
Decrease spacing between li anchor elements
I am currently using the following html and css to style my navigation buttons:
CSS
#nav {
position: absolute;
top: 42px;
left: 220px;
list-style: none;
height: 84px;
display: inline;
overflow: hidden;
width: 510px;
}
#nav li {
margin: 0;
padding: 0;
display: inline;
list-style-type: none;
}
#nav a {
float: left;
padding: 34px 0 0 0px;
overflow: hidden;
height: 0px !important;
height /**/:34px; /* for IE5/Win */
}
#nav a:hover {
background-position: 0 -34px;
}
#nav a:active, #nav a.selected {
background-position: 0 -34px;
}
#thome a {
width: 84px;
height: 34px;
background: url(images/home_nav.jpg) top left no-repeat;
}
#tproducts a {
width: 84px;
height: 34px;
background: url(images/products_nav.jp g) top left no-repeat;
}
#tservices a {
width: 84px;
height: 34px;
background: url(images/services_nav.jp g) top left no-repeat;
}
#thelpcenter a {
width: 84px;
height: 34px;
background: url(images/helpcenter_nav. jpg) top left no-repeat;
}
#tabout a {
width: 84px;
height: 34px;
background: url(images/about_nav.jpg) top left no-repeat;
}
#tcontact a {
width: 84px;
height: 34px;
background: url(images/contact_nav.jpg ) top left no-repeat;
}
HTML
<ul id="nav">
<li id="thome"><a href="http://domain.com/index.php" class="selected">home</a>< /li>
<li id="tproducts"><a href="http://domain.com/products.php">products</a></li>
<li id="tservices"><a href="http://domain.com/services.php">services</a></li>
<li id="thelpcenter"><a href="http://domain.com/helpcenter.php">help center</a></li>
<li id="tabout"><a href="http://domain.com/about.php">about</a></li>
<li id="tcontact"><a href="http://domain.com/contact.php">contact</a></li>
</ul>
My problem is this...I want to bring the individual li anchors closer together. Normally this would be done here...
#nav a {
float: left;
padding: 34px 0 0 0px; <<<<<<<< last 0px
overflow: hidden;
height: 0px !important;
height /**/:34px; /* for IE5/Win */
}
increasing the value moves them further apart but entering a -2px makes them disappear. Am I missing something??
CSS
#nav {
position: absolute;
top: 42px;
left: 220px;
list-style: none;
height: 84px;
display: inline;
overflow: hidden;
width: 510px;
}
#nav li {
margin: 0;
padding: 0;
display: inline;
list-style-type: none;
}
#nav a {
float: left;
padding: 34px 0 0 0px;
overflow: hidden;
height: 0px !important;
height /**/:34px; /* for IE5/Win */
}
#nav a:hover {
background-position: 0 -34px;
}
#nav a:active, #nav a.selected {
background-position: 0 -34px;
}
#thome a {
width: 84px;
height: 34px;
background: url(images/home_nav.jpg) top left no-repeat;
}
#tproducts a {
width: 84px;
height: 34px;
background: url(images/products_nav.jp
}
#tservices a {
width: 84px;
height: 34px;
background: url(images/services_nav.jp
}
#thelpcenter a {
width: 84px;
height: 34px;
background: url(images/helpcenter_nav.
}
#tabout a {
width: 84px;
height: 34px;
background: url(images/about_nav.jpg) top left no-repeat;
}
#tcontact a {
width: 84px;
height: 34px;
background: url(images/contact_nav.jpg
}
HTML
<ul id="nav">
<li id="thome"><a href="http://domain.com/index.php" class="selected">home</a><
<li id="tproducts"><a href="http://domain.com/products.php">products</a></li>
<li id="tservices"><a href="http://domain.com/services.php">services</a></li>
<li id="thelpcenter"><a href="http://domain.com/helpcenter.php">help center</a></li>
<li id="tabout"><a href="http://domain.com/about.php">about</a></li>
<li id="tcontact"><a href="http://domain.com/contact.php">contact</a></li>
</ul>
My problem is this...I want to bring the individual li anchors closer together. Normally this would be done here...
#nav a {
float: left;
padding: 34px 0 0 0px; <<<<<<<< last 0px
overflow: hidden;
height: 0px !important;
height /**/:34px; /* for IE5/Win */
}
increasing the value moves them further apart but entering a -2px makes them disappear. Am I missing something??
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER