In typical style sheets, block elements have margins, but their width property is not set (i.e., it is auto). That allows the user to resize the window and the element with it. But, you can protect the element from becoming too narrow or too wide by setting the properties min-width and max-width, respectively.
More rare is the use of min-height and max-height, but they exist in case you need them.
If the value is specified as a percentage, it is relative to the height of the block element in which this element is contained, but only if the height of that block is set explicitly; otherwise, the percentage (and the property with it) is ignored. |