I have a division with a label as below in code, and I would like to know the complete width of the label by javascript, but the label seems to collapse automatically to fit within the division. So if I measure the label width, it is the 100px of the division.
<div style="width: 100px; overflow: hidden; background-color: lime;">
<label id="getMyWidthLabel" style="background-color: cyan;">
Some text which is longer than the div's 100 pixels.
</label>
</div>
Now if I would place an width on the label like style="width: 200px", I get the preferenced look (no collapsion, but the label is not measurable anymore.
What css or javascript do i need and why?
EDIT: I would like to measure the width of the label as seen here:
But because it stands in a division, it automatically breaks and I can't measure the full width anymore: