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 trial

CSS CSS Foundations The Box Model Width, Height and Overflow Properties

Carlo Sabogal
Carlo Sabogal
7,468 Points

Can I use max-width and min-width, max-height and min-height in the same property?

for example:

.box {min-height: 50px; max-height:50px; min-width: 50px; max-width: 50px;}

4 Answers

Yes you can..but why wouldn't you just use .box {width: 50px; height: 50px:} ?

Carlo Sabogal
Carlo Sabogal
7,468 Points

yeah, sorry Shawn, i meant ...box {min-height: 50px; max-height:100px; min-width: 50px; max-width: 100px;}, would it work with percentages as well? thanks!

ah gotcha!

Yes you absolutely can! In fact that is really what the standard was created for!

Also you can play and experiment with these kinds of things at codepen.io

yes, you can use it.browser will overwrite these properties.first it will use max-width prperty and then min-width.