Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS How to get the actual height of a parent div? Re: How to get the actual height of a parent div?

#122493
jquser12
Member

Ty you all guys, think I have finally figured it out.
I tried checking the website you suggested wolfcry911, but couldn’t grasp much from there, so i tried searching some other sites (many.. so can’t ref them all here) besides some of the css official documentation (http://www.w3.org/TR/CSS2/box.html) (http://www.w3.org/TR/CSS2/visuren.html) and the conclusion I had figured out (I think) is:

Since I dont include padding, border, or anything else before the form’s margin, **its margin will collapse with the #login’s margin**, so if I had included a “padding: 1px” property in #login, it would also work out, since the collapse wouldn’t be allowed anymore =]. That is also the reason why the ‘border’ property I mentioned earlier would also work.
As for the display properties, it’s as wolfcry911 said: they create a new block formatting context, **which doesn’t allow margin collapsing either**, and that’s why it works: the form’s margin remains inside the #login block, instead of out of it, collapsed with its own margin, so the outerHeight can be calculated as I expected =]

In the end, it was all about “margin collapsing” properties, which by this day I’d never heard about ‘-‘

Ty again guys o/