Min and Max Width/Height in CSS

Avatar of Chris Coyier
Chris Coyier on (Updated on )

Here’s a nice deep dive into min-width / min-height / max-width / max-height from Ahmad Shadeed. I like how Ahmad applies the properties to real-world design situations in addition to explaining how it works. In the very first demo, for example, he shows a button where min-width is used as a method for (trying to) make sure a button has space on its sides. It works if the text is short enough, and fails when the text is longer. That’s the kind of “CSS thinking” that is fundamental to this trade.

Direct Link →