Minimum and Maximum Widths and Heights


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.

Name:

min-width

Value:

<length> | <percentage> | inherit

Initial:

medium

Applies to:

all elements

Inherited:

yes

Percentages:

relative to parent's font size


Name:

max-width

Value:

<length> | <percentage> | inherit | none

Initial:

none

Applies to:

replaced elements and block-level elements

Inherited:

no

Percentages:

refer to width of containing block


More rare is the use of min-height and max-height, but they exist in case you need them.

Name:

min-height

Value:

<length> | <percentage> | inherit

Initial:

0

Applies to:

replaced elements and block-level elements

Inherited:

no

Percentages:

refer to width of containing block


Name:

max-height

Value:

<length> | <percentage> | inherit | none<

Initial:

none

Applies to:

replaced elements and block-level elements

Inherited:

no

Percentages:

refer to width of containing block


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.



Cascading Style Sheets(c) Designing for the Web
Cascading Style Sheets: Designing for the Web (3rd Edition)
ISBN: 0321193121
EAN: 2147483647
Year: 2003
Pages: 215

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net