Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

outerwidth and width returns wrong value in firefox relative to chrome

Tags:

jquery

I'm trying to get the width of an element using element.outerWidth. When I'm using Chrome it returns a correct value, but when I'm switching to firefox I got a much lower value. In what way does firefox read this element different from chrome?

Element:

<div class="submit_container">
     <input type="submit" value="Something" />
</div>

Chrome: 88px
Firefox: 36px

When I inspect the element using firefox it display the same with as in chrome. (88px)

like image 616
hgerdin Avatar asked May 30 '13 13:05

hgerdin


1 Answers

Have you tried using jQuery width?

$(element).width();

It has a slight difference but I guess it's a cross-browser issue.

EDIT:

I think the line-spacing was the one causing the difference in width. Try removing it in Firefox and you'll see the difference

like image 104
Jude Duran Avatar answered Nov 10 '22 01:11

Jude Duran