Jump to content

Can I Set The Minimum Height Of An Element Using A Percent Value?


Phillip Bromley
 Share

Recommended Posts

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

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. :)

Edited by jlhaslip
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...