hgerdin
hgerdin

Reputation: 637

outerwidth and width returns wrong value in firefox relative to chrome

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)

Upvotes: 7

Views: 3849

Answers (1)

Jude Duran
Jude Duran

Reputation: 2205

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

Upvotes: 3

Related Questions