Width or min-width?

Which would you consider best practice? Should I allow the width of a box to go below what I want it to be?


-jj. :slight_smile:

It’s up to you, really, and depends on circumstances. Sometimes it’s practical to set a min-width so that the container doesn’t get smaller than things like images within it. Do you have an example to apply this to?

As Ralph said it depends.

If the layout breaks below a certain with and is unusable then there’s no point in letting it get smaller unless you can maintain legibility etc.

If the element contains fixed width content (such as an image) then again there’s no point in letting the parent be smaller than the largest fixed width element it contains - which is something you should really do by default otherwise background and borders continue to get smaller while some elements of the page poke out the side.