Jump to content

Variable height for DIV


Mark H

Recommended Posts

For a div that will have varying heights according to the amount of content added, should I use height: auto or min-height: 100px ?I'm using CSS2.Thanks, Mark.

Link to comment
Share on other sites

Depends, if you have a few lines of content the page may look strange/empty if you have darker outer background, with light background for text, especially if you have high resolution screen where the height of screen is large. By using min-height: you set the min-height of content container, regardless of content, but remember ie6 does not support min-height.

Link to comment
Share on other sites

For a div that will have varying heights according to the amount of content added, should I use height: auto or min-height: 100px ?I'm using CSS2.Thanks, Mark.
height and min-height are not mutually exclusive.If height is auto, and min-height is 100px, the element will be 100px tall if there is not enough content within it to expand it to 100 pixels in height, however, if the element's content would make it expand beyond 100px, the 100px min-height is irrelevant and has no effect on the element.
Link to comment
Share on other sites

Depends, if you have a few lines of content the page may look strange/empty if you have darker outer background, with light background for text, especially if you have high resolution screen where the height of screen is large. By using min-height: you set the min-height of content container, regardless of content, but remember ie6 does not support min-height.
Ah, I would think I'd go for min-height then, but what is the solution for IE6? Would it be to do as Dilated suggests?Thanks,Mark.
Link to comment
Share on other sites

Would it be to do as Dilated suggests?
He basically gave the same answer, height is set to height: auto; by default.IE6 i suppose you could use a floated right container/image 1px wide spacer set to you minimum height, you could have it as display: block; for IE6 only, and display: none; for other browsers and other IE versions.
Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...