Brian Tucker
Brian Tucker

Reputation: 310

How to auto space list elements within a div

I am working on a website that has these tabs at the top which I need to have automatically spaced inside a div. The reason for this, is that the div below it has a border that needs to line up with the borders on the tabs. See my jsfiddle below for what I'm talking about. I currently have them all spaced correctly, but the nature of this site is that the words in the tabs will change, making my spacing incorrect. How can I automatically space them inside my div so I don't have to tinker with all the individual padding to make them line up with the div below?

http://jsfiddle.net/g7c5X/

Upvotes: 0

Views: 204

Answers (1)

Ben
Ben

Reputation: 1022

Should be able to achieve it by adding to your CSS something like this:

    #navMenu ul {display:table; width:100%}
    #navMenu li {display:table-cell}

I think older versions of IE may ignore the display type can't remember which. The other option would be some javascript to calculate the margins.

Upvotes: 1

Related Questions