Let’s say i got a list looking like this:
<ul style="width:980px;">
<li style="display:block; float:left;">Lorem ipsum</li>
<li style="display:block; float:left;">Lorem ipsum #2</li>
<li style="display:block; float:left;">Lorem ipsum #3</li>
<li style="display:block; float:left;">Lorem ipsum #4</li>
<li style="display:block; float:left;">Lorem ipsum #5</li>
<li style="display:block; float:left;">Lorem ipsum #6</li>
</ul>
How would i find the correct width of each li in this list?
Currently i tried to loop the li’s and then print out the outerWidth, innerWidth and width.
All seems to return 0 as width.
Got any ideas on how to get the correct with of the elements without having to calculate the length of the string?
You can just use the width method. eg.
This requires:
display: nonehttp://jsfiddle.net/DvNf5/