Producing web pages
* HTML CSS DHTML XHTML A to Z of tags        Accessibility          Design

Box properties

These properties control the format of the box associated with tags. The box is the area of space that the tag occupies when the browser displays it. Not all browsers support all the properties.

Property

Description

Values

Example

border

Sets the properties of the border

border-width
border-style
border-color

{ border: thin solid blue; }

border-color

Sets the colour of the border

color

{ border-color: green red white blue; }

border-bottom

Sets the properties of the bottom border

border-width
border-style
border-color

{ border-bottom: 10px ridge gray; }

border-bottom-color

Sets the colour of the bottom border

color

{ border-bottom-color:black; }

border-bottom-style

Sets the style of the bottom border

none
dotted
dashed
solid
double
groove
ridge
inset
outset

{ border-bottom-style:groove; }

border-bottom-width

Sets the width of the bottom border

thin
medium
thick
width

{ border-bottom-width:thick; }

border-left

Sets the properties of the left border

border-width
border-style
border-color

{ border-left: 1px groove red; }

border-left-color

Sets the colour of the left border

color

{ border-left-color:#C0C0C0; }

border-left-style

Sets the style of the left border

none
dotted
dashed
solid
double
groove
ridge
inset
outset

{ border-left-style:none; }

border-left-width

Sets the width of the left border

thin
medium
thick
width

{ border-left-width:15px; }

border-right

Sets the properties of the right border

border-width
border-style
border-color

{ border-right: thick inset maroon; }

border-right-color

Sets the colour of right the border

color

{ border-right-color:whitesmoke; }

border-right-style

Sets the style of the right border

none
solid
dotted
dashed
double
groove
ridge
inset
outset

{ border-right-style:double; }

border-right-width

Sets the width of the right border

thin
medium
thick
width

{ border-right-width:medium; }

border-style

Sets the style of the border

none
solid
double
groove
ridge
inset
outset

{ border-style:ridge; }

border-top

Sets the properties of the top border

border-width
border-style
border-color

{ border-top: medium outset red; }

border-top-color

Sets the colour of the top border

color

{ border-top-color:navajowhite; }

border-top-style

Sets the style of the top border

none
solid
dotted
dashed
double
groove
ridge
inset
outset

{ border-top-style:solid; }

border-top-width

Sets the width of the top border

thin
medium
thick

{ border-top-width:thin; }

border-width

Sets the width of the border

thin
medium
thick
width

{ border-width: 3px 5px 3px 5px; }

margin

Sets the margins

auto
points (pt)
inches (in)
centimetres (cm)
pixels (px)*

{ margin: 10px 5px 10px 5px; }

margin-bottom

Sets distance from bottom edge of page.

millimetres (mm)
centimetres (cm)
inches (in)
points (pt)
picas (pc)
pixels (px)
height of font (em)
height of letter x (ex)

{ margin-bottom:1em; }

margin-left

Sets distance from left edge of page.

millimetres (mm)
centimetres (cm)
inches (in)
points (pt)
picas (pc)
pixels (px)
height of font (em)
height of letter x (ex)

{margin-left: 1in}

margin-right

Sets distance from right edge of page.

millimetres (mm)
centimetres (cm)
inches (in)
points (pt)
picas (pc)
pixels (px)
height of font (em)
height of letter x (ex)

{margin-right: 1in}

margin-top

Sets distance from top edge of page.

millimetres (mm)
centimetres (cm)
inches (in)
points (pt)
picas (pc)
pixels (px)
height of font (em)
height of letter x (ex)

{margin-top: -20px}

padding

Sets the size of the padding.

millimetres (mm)
centimetres (cm)
inches (in)
points (pt)
picas (pc)
pixels (px)
height of font (em)
height of letter x (ex)

{ padding: 10px 10px 10px 15px; }

padding-bottom

Sets the size of the bottom padding.

millimetres (mm)
centimetres (cm)
inches (in)
points (pt)
picas (pc)
pixels (px)
height of font (em)
height if letter x (ex)

{ padding-bottom:1.2em; }

padding-left

Sets the size of the left padding.

millimetres (mm)
centimetres (cm)
inches (in)
points (pt)
picas (pc)
pixels (px)
height of font (em)
height of letter x (ex)

{ padding-left:10pt; }

padding-right

Sets the size of the right padding.

millimetres (mm)
centimetres (cm)
inches (in)
points (pt)
picas (pc)
pixels (px)
height of font (em)
height of letter x (ex)

{ padding-right:15px; }

padding-top

Sets the size of the top padding.

millimetres (mm)
centimetres (cm)
inches (in)
points (pt)
picas (pc)
pixels (px)
height of font (em)
height of letter x (ex)

{ padding-top:10%; }