Skip to main content
randev

Setting widths and heights

  • CSS

Should I use this or that or none? Width or max-width? Height or min-height?

1. width:

You would often use this with max-width: most of the time. Setting fixed widths such as width: 320px or width: 2rem is rarely done and not even reccomended as you would likely use max-width: for it. Use fixed widths for smaller stuff like icons and avatars which rarely cause overflow.

2. min-width

3. max-width:

4. height

5. min-height

6. max-height


Back to top