I'm trying to find a simple method of getting all the links spread evenly over the horizontal navigation. This would be very easy if it would be a fixed amount of links, but they will be dynamic.
So it could be either 5 or 10 links, nobody knows. Despite the amount of links I would like them to spread evenly across the navigation without using a table.
The reason I don't want to use a table is because it will break the UL LI structure which is (apparently) considered the way to go when building a navigation (SEO).
Here's a jsFiddle explaining it more in depth: http://jsfiddle.net/pkK8C/19/
Looking for the most light method.
Thank you in advance.
The simplest way to get the effect you are looking for (for any number of buttons) is to use a table with a 100% width. A more complicated way is to give each button an equal percentage width such that with the number of buttons it adds up to 100%. You have 5 buttons, so you can put width:20%; on #nav ul li .
Use display: table
for UL
and display: table-cell
for LI
. And display-table.htc for IE6/7 if they matter.
Old browser might be a headache, but it works for new ones:
div#navigation ul {
list-style-type:none;
height:30px;
text-align:center;
width: 100%; /* new */
display: table; /* updated */
}
div#navigation ul li {
margin-left:50px;
display: table-cell; /* updated */
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With