简体   繁体   中英

how to get actual width of an element with floating element on it

I'm trying to get the width of a paragraph element like in the pic. 在此处输入图片说明

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

give your paragraph in css

p{
   display: table;
}

in js use

$('p').outerWidth();

DEMO tested in chrome and ie

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM