Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

Get width of div with columns

Tags: width

Get width of div with columns

Problem

I have a simple markup

.content{
    -webkit-column-width: 100px;
    width : 200px;
    height: 100px;
}
​
Much text so the text will extend the box...

When I use jQuerys Width function it always return 200 which is wrong, or at least not what I expected.

I need to measure the width of the div with class content and it has a lot of text inside, that will extend the div.

http://jsfiddle.net/EJEsP/

Problem courtesy of: Simon Edström

Solution

.content{
    -webkit-column-width: 100px;
    width : 200px;
    height: 100px;
}
#wrapper {
    width : auto;
}


Many lines
alert($("#wrapper").width())​

Insert your content into another div with width:auto and get that div's width with jQuery.

Solution courtesy of: gabitzish

Discussion

View additional discussion.



This post first appeared on CSS3 Recipes - The Solution To All Your Style Problems, please read the originial post: here

Share the post

Get width of div with columns

×

Subscribe to Css3 Recipes - The Solution To All Your Style Problems

Get updates delivered right to your inbox!

Thank you for your subscription

×