Public Voice Network
- menu btn not working
- QBNers in Asia? 55
- QBN 2525
- New Site Feedback
- Super Bowl Logo (Vector) 22
- God is quite busy 8080
- blog 3122031220
- question for photographer… 99
- Favorite brands 3131
- Canadian Politics con'… 5959
- Favorite Beer? 128128
- For TheBlueOne 11
- Dexter, Season III 5757
- Cuts Like a Knife 1111
- Pic of the Day 1049910499
- rippity rip 6060
- Simple AJAX quiz script 55
- fastfood 99
- B. Fleischmann
- this is for... you! 33
- Public Enemy 2929
- Aquarium owners 11
- What are you listening to… 961961
- FMT 120508 2929
how to center floating elements? 1010 Responses
Last post: 6 months, 1 week ago | Thread started: May 29, 08, 2:48 a.m.
- bezul555
Hi, I have one problem;
There is navigation bar, with list as buttons<div id="nav">
<ul>
<li>item</li>
<li>item</li>
<li>item</li>
</ul>
</div>All list items <li> are floted to the left, but I want them to appear in the center of the navigation bar <div id="nav">; I tried margin: 0 auto 0; for <ul> but it doesn't work; the problem is that number of the list items is different on every page;
Thanks- May 29, 08, 2:48 a.m. – Permalink
- Haydesign
<div id="navcontainer">
<ul id="navlist">
<li id="active"><a href="#" id="current">Item one</a></li>
<li><a href="#">Item two</a></li>
<li><a href="#">Item three</a></li>
<li><a href="#">Item four</a></li>
<li><a href="#">Item five</a></li>
</ul>
</div>CSS
ul#navlist
{
margin-left: 0;
padding-left: 0;
white-space: nowrap;
}#navlist li
{
display: inline;
list-style-type: none;
}#navlist a { padding: 3px 10px; }
#navlist a:link, #navlist a:visited
{
color: #fff;
background-color: #036;
text-decoration: none;
}#navlist a:hover
{
color: #fff;
background-color: #369;
text-decoration: none;
}

- Dog-earMay 29, 08, 5:27 a.m. – Permalink


