Please have a look at this fiddle.
This is a very dumbed-down version of a more complex form. In .dojoxAlertBar, the height is set to 100% for programming reasons. Things are all good, until I set the height for #registerform as a set number:
/* height:117px; */
Without this, the height of the message is “as big as it needs to be”. However, uncommenting the 117px height in the CSS has the result of making the height of .dojoAlertBox equal to #registerForm.
Can somebody please explain why that is? I keep on misunderstanding how “height” works in CSS. What does that “100%” actually mean? If it means “100% of the containing element”, then why isn’t it set as “big” even when there is no specified height for the parent?
In fact, if I can beg, having a simple table of how the height is calculated for fixed/absolute and relative/static elements, that would be great too.
To give an element (
.dojoAlertBar) a percentage height, its parent element (#registerForm) must have an explicit height. Since, in your example,.registerFormhas a height of auto, the block will take the height of its content.A height of 100% means the element will have a height that is 100% of its parent. Therefore, the parent div must have an explicit height property. When you give
#registerFormthe height of 117px, that means.dojoAlertBarwill be 100% of that height, or 117px.