Give a min-height:100% to all divs
I've been trying to accomplish this with this
开发者_JAVA百科http://jsfiddle.net/madprops/MC47z/
But I can't manage to do it, can somebody help me?
The intended way to make elements inherit properties from others is by relying on "the cascade". If a parent element has a particular style (height: 100% for example) then its child elements usually (not always) inherit that style. Sometimes you have to explictly make elements inherit certain styles.
Mention of the cascade in the W3C CSS tutorial: http://www.w3schools.com/css/css_howto.asp
CSS specification: http://www.w3.org/TR/CSS2/cascade.html
Third-party explanation of the cascade: http://www.blooberry.com/indexdot/css/topics/cascade.htm
If setting style on the parent element is forbidden, then you can create a "class". Style assigned to the class will apply to any element assigned to that class in the document. So creating a new CSS class does nothing by itself; the document has to assign elements to the class.
W3Schools explanation of classes: http://www.w3schools.com/css/css_id_class.asp
精彩评论