Public Voice Network
- blog 2741727417
- Engaged!! 2828
- wiser now 1212
- firelite won't mount 99
- Eyeball Acuracy Test 88
- hotel626 can you win? 55
- Just Launched 1919
- Flash component sites 33
- @ party 1919
- Wanted back 1717
- Scrollbar widths? 77
- Desk for a Designer 22
- Stocks and eTrade 4545
- Tim Robbins 77
- Heroes 10761076
- LEED for design? 55
- Pic of the Day 88268826
- font help / advice 1515
- Entourage season premiere… 3636
- Leica M6 vs M7 1414
- NFL thread 2929
- Official NFL 08/09 Season 8989
- Mad Men 5252
- Vid of the Day 459459
how to center floating elements? 1010 Responses
Last post: 4 months, 2 weeks 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


