Well, here's the thing - it's a bit complicated.
I'm dealing with a navigation list where the list items are set to inline-block
. The number of items in the list can change, so it's not fixed.
My goal is to make the list items stretch across the entire width of the container. (For example, if there are 4 list items, each should take up 25% of the container width [ignoring margins/padding]).
The tricky part is that browsers tend to add a 4px margin to inline-block elements when there is whitespace between them (like a linebreak or space).
I've created a fiddle to illustrate what I have so far with 2 examples: the first just shows the list items in inline-block mode, while the second one aligns them across the width.
However, neither of them accomplishes what I am aiming for, which is to have the elements take up the full width without wrapping onto a new line.
edit: On a slightly different note, why is there space below the li
s in my second example, even though I've set the line-height and font-size to 0?