Skip to main content

Bug Tracker

Side navigation

#11616 closed bug (invalid)

Opened April 21, 2012 07:01PM UTC

Closed April 23, 2012 04:29PM UTC

Last modified April 24, 2012 11:58AM UTC

outerHeight not properly calculated when children have margins

Reported by: Owned by:
Priority: low Milestone: None
Component: dimensions Version: 1.7.2
Keywords: Cc:
Blocked by: Blocking:

I have created a JSFiddle here which illustrates best what I try to explain here:

Basically, when there is a container div with children, and the children have a margin, then outerHeight(true) returns an incorrect value for the container div. It will return the height as if the top-margin of the top-child and the bottom-margin of the bottom-child would not apply.

Attachments (0)
Change History (5)

Changed April 23, 2012 04:29PM UTC by rwaldron comment:1

component: unfileddimensions
priority: undecidedlow
resolution: → invalid
status: newclosed

This is not a jQuery bug, the outer element has a height of only 20px:

Changed April 23, 2012 05:24PM UTC by dmethvin comment:2

Changed April 24, 2012 06:53AM UTC by anonymous comment:3

I see that it's not jQuery's problem, but I still don't really understand why the browser only returns 20px... The margins of the inner elements 'move' to the parent element? Then still the parent would have the 60px if it includes its margins, right? Why are the margins of both the parent itself and the children not taken into account when the browsers calculates its height?

Changed April 24, 2012 11:53AM UTC by dmethvin comment:4

Your answers won't be found in a bug tracker. Try a forum.

Changed April 24, 2012 11:58AM UTC by anonymous comment:5

True, I'll try there :-) Thanks!