Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialAakash Srivastav
Full Stack JavaScript Techdegree Student 11,638 Pointsmin-height
Can I use "height" property instead of "min-height" property? As I check the result , it's same here . Then where it matters?
3 Answers
Steven Parker
231,275 PointsThose properties will work the same when the contents fit within the value specified.
The difference will be seen when the contents are too large to fit in the value. In that case the item with the "min-height
" property will expand but the one where "height
" is set will either overflow or be clipped, depending on the setting of the container.
Vito Huang
7,281 PointsSteven Parker thank you for your clear explanation. I still couldn't understand why the one where "height" is set would either overflow or be clipped. Could you please explain it a bit more?
Steven Parker
231,275 PointsWhere "min-height" just sets a limit (and the actual size can be larger if space is available), the "height" value is a specific size that should be adhered to. If the actual object is larger than this value, the browser will normally shrink it down to fit or in the case of a background, clip any portion that doesn't fit.
I suggest that a little experimentation will be far more valuable than any explanations.
Vito Huang
7,281 PointsThanks, Steven. I think I got the point.
Aakash Srivastav
Full Stack JavaScript Techdegree Student 11,638 PointsAakash Srivastav
Full Stack JavaScript Techdegree Student 11,638 PointsOh ....got this Thanks Steven Parker :)