Should we give overflow:hidden to those div for which we are not giving height?
#Container {width:900px;margin:0 auto}
for #header
which has other elements inside then should i give overflow:hid开发者_如何转开发den
to #header
or i should give fixed height to #header
.
What is the difference between both?
#header {}
#footer {}
No, it's not needed.
That rule is used as a work around to allow a container to take the full height of its child elements when they are floated. So unless you're floating elements inside it, the rule is extraneous, as there will be no overflow because the height is not specified.
See here for more info on why you would use overflow: hidden
.
精彩评论