I’m wondering if it is possible to do this in CSS, without javascript:
A list of N <li> items, with display inline, equal width, and the width of the all equal to the width of the container
I can have 3 <li> items, in this case the <li> width will be 33%, or I can have 4 <li> items, then the li width will be 25%.
It is possible with CSS3 flex boxes, as demonstrated in this fiddle (for webkit browsers only). There are other browser custom properties that would make this work for recent versions of Firefox and IE. If you need something that works for Opera or older versions of IE then there is a JavaScript library called Flexie which might work.
Credit to The CSS3 Flexible Box Layout (flexbox) for the information on the browser support.
HTML
CSS