In my script, i need to get width of an element in “ex” units (font width)
Is there any way to do this using JavaScript, jQuery ?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Not directly. jQuery uses the
offsetWidthandoffsetHeightproperties, which only return integer values. If the exact width you’re looking for is specified in the stylesheet, you can probably useelement.css('width')and get the intended result, but, otherwise, you’ll have to either do some serious trickery to convert, or just deal with using pixels instead.