I want to use a list for horizontal links. I understand I need to use display: block for the ul and display: inline for the li.
There are a number of questions for getting constant width for the li elements, but I want constant space between them, they contain text of different width themselves.
Thanks.
I think my question was unclear:
I am looking to have a fixed width ul with unknown width li elements and want to have constant space between them, not constant width li elements. Is this only achievable with javascript?
Use the margin css property. If they all have the same margin, then the distances between the content of the adjacent
<li>swill be the same.You might want to take a look at the Box Model
Edit to address comment below:
If you want the gaps between the items to stay the same regardless of the content, margin should do the job. If you want the position of the items to stay the same regardless of the content (and so the gaps between them will change), you need to set the width of the item.