0

I'm trying to get the width of a paragraph element like in the pic.enter image description here

I want to get the width of the content in the red box, while when I'm using $("p").width(), I got 800, but there is an image float on it's right side.

How can I get the ACTUAL width of this paragraph?

The page url is : http://www.businessinsider.com/healthy-at-work-without-a-standing-desk-2014-12?utm_content=&utm_medium=email&utm_source=alerts&nr_email_referer=1

1
  • 1
    try wrapping the contents of the paragraph in a span and see what span width returns. can use wrapInner() if that helps
    – charlietfl
    Dec 6, 2014 at 4:56

1 Answer 1

0

give your paragraph in css

p{
   display: table;
}

in js use

$('p').outerWidth();

DEMO tested in chrome and ie

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.