HTML and CSS Reference
In-Depth Information
The
width
property defines the width of an element.
■
<length>
: The width will be a fixed dimension.
■
<percentage>
: The width will be a percentage of the containing
block's width.
■
auto
: The width will be calculated based on the available horizontal
space (default).
The
height
property sets the height of an element.
■
<length>
: The height will be a fixed dimension.
■
<percentage>
: The height will be a percentage of the containing
block's specified height; this is the equivalent of
auto
if no containing
block height was specified.
■
auto
: The height will be calculated to fit the available content (default).
The
margin
property sets the four margins surrounding an element. Each
side may take one of the following property values:
■
<length>
: The margins will be a fixed dimension.
■
<percentage>
: The margins will be a percentage of the containing
block's width (applies for margins in the vertical as well as horizontal
directions).
■
auto
: For the left and right margins,
auto
is calculated to be the
length needed to reach the containing element's sides; for the top
and bottom, it is calculated as 0.