Phillip Bromley Posted April 28, 2009 Share Posted April 28, 2009 On the CSS Dimension Properties page on W3Schools's CSS tutorial, I shows how to use CSS to set the height and width of elements.Also on this page it is mentioned how to set the minimum height using a pixel value, it it possible to do this with a percent value instead?In the "set the minimum height of an element using a pixel value" example in the TryIt Editor...http://www.w3schools.com/CSS/tryit.asp?fil..._dim_min-heightIt uses the following code:<html><head><style type="text/css">p{min-height: 100px}</style></head><body><p>This is some text. This is some text. This is some text.This is some text. This is some text. This is some text.This is some text. This is some text. This is some text.</p><img src="logocss.gif" width="95" height="84" /></body></html>I changed it to this:<html><head><style type="text/css">p{min-height: 88.75%}</style></head><body><p>This is some text. This is some text. This is some text.This is some text. This is some text. This is some text.This is some text. This is some text. This is some text.</p><img src="logocss.gif" width="95" height="84" /></body></html>And it failed to adjust the minimum height accordingly. I also tried adding a semicolon ( ; ) to the end, it still didn't work.Is there any way I can set the minimum height with a percent value? If not, will this be possible with HTML 5.0? Link to comment Share on other sites More sharing options...
jlhaslip Posted April 28, 2009 Share Posted April 28, 2009 Which Browser are you using? I don't believe IE supports min-width or min-height.And it doesn't seem to work as a percent in FF3, either. Link to comment Share on other sites More sharing options...
Phillip Bromley Posted April 28, 2009 Author Share Posted April 28, 2009 I use FireFox 3.0.9, and the CSS Dimension Properties page has a table (near the bottom) showing that the min-height property supports a percent value. Why isn't it working? Link to comment Share on other sites More sharing options...
Ingolme Posted April 28, 2009 Share Posted April 28, 2009 A percentage height value will only work if the parent element has a defined height. Link to comment Share on other sites More sharing options...
Phillip Bromley Posted April 28, 2009 Author Share Posted April 28, 2009 Yes!!! It worked!!! Thanks a lot guys. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.