Forums

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

Home Forums CSS CSS Height by percentage Reply To: CSS Height by percentage

#156549
paulob
Participant

Setting a height on elements is a bad move if they are going to contain fluid elements like text because the content will spill out if the text is resized or if there is simply not enough room (e.g. when the browsers window is closed smaller).

I think you need to explain a little more about what you are trying to achieve as I can’t see much use for the elements to be spread across the viewport like that unless its just a simple page with a few headings or similar.

You always need to try out your demos with “real content” so that you can see what will happen when there is too much (or too little) content in your elements.:)

You could use Merri’s code above but use display:table (IE8+) so that the element can still grow if required.

.div1,.div2,.div3 {display:table;width:100%}