Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS General rule of thumb for settings the heights is don't Reply To: General rule of thumb for settings the heights is don't

#275821
Beverleyh
Participant

Yes, not setting heights is a general rule of thumb, although, as with most things, it depends on what you’re doing. Using media queries to change heights at given breakpoints is perfectly acceptable. I would take the rule to be more applicable to divs containing text, and would think it relates more to situations with fluid widths since you can’t accurately predict how tall containers will stretch to at every incremental pixel change to accommodate the text inside (words are different lengths, lines break unpredictably). The idea is to let the content flow and create whatever height is needed to contain it. Images are a bit different and are more predictable.

Max-width = don’t let this element be any bigger than this specified value.

Min-width = don’t let this element be any smaller than this specified value.

For more advice on how/when to use them, try Googling “width min-width max-width” and read some of the articles that come up. Your question is otherwise too general for us to answer, but if you can provide code and examples of real-life usage/issues you’re having, we might have an easier time.