How can I get a div width when the div is inside another div with "overflow: hidden;" ?
I tried to set overflow as auto and after using $("#divselector").width() but I always get the parent div width!
Ex:
html:
<div id="content">
<div id="item">content content content ...</div>
</div>
css:
#content
{
width: 760px;
height: 100%;
overflow: hidden;
display: block;
position: relative;
cursor: move;
}
Detail: using IE 6 work, but in IE 8 no...
By default, div's will expand to the width of their parent.
If you float your items within the div, the item will no longer expand to the width of the parent.
Add the following to your styles:
#item { float: left; }
See how this works: http://jsbin.com/umabe/edit
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With