Block level elements follow the CSS box model. Their margin
,
padding
, border
and
background
can all be styled.
At the very outside of the box are the margins. Each margin's size can be set individualy with the properties margin-top, margin-bottom, margin-left and margin-right, or you can use the shorthand property margin to specify all four margins together. The syntax of the shorthand property is:
margin: top right bottom left
If there are only:
Prince expands the margin properties with margin-inside
and margin-outside
, defining the margin
respectively on the inside or outside of a spread: inside is on the right when
used on a left-facing page, and on left on a right-facing page; outside is on
the left when used on a left-facing page, and on the right on a right-facing
page.
Always keep in mind that margin-top
and
margin-bottom
of blocks are combined (i.e.
"collapsed") into a single margin according to a possibly rather complex
behaviour known as margin collapsing.
The property padding
defines the padding sinside the box model.
Each padding's size can be set individualy with the properties
padding-top, padding-bottom,
padding-left and padding-right, or you can
use the shorthand property padding to specify all four
paddings together. The syntax of the shorthand property is:
padding: top right bottom left
If there are only:
The border of a box can be styled with several border properties. The borders can
either be individually styled with border-top
,
border-right
, border-bottom
and border-left
, or the shorthand property
border
can be used to style all four borders of
the box in the same way.
To style the borders, the border-color
,
border-style
and
border-width
properties can be used. For each
of them, also top
, right
, bottom
and
left
variants are available to style each border separately.
The property border-radius
property can be used
for styling rounded corners.
The border-clip
property splits the borders into
parts along the border edge - the first part is visible, the second one is
invisible, the third part is visible, etc.
The background of an element can be styled with the
background-color
and the
background-image
properties, or with the
shorthand property background
.
Various standard properties are available to position the background, to clip it
or to determine whether, and how it should be repeated. Prince extends control
on the background with the prince-background-image-resolution
property, used to control image size in print (see Image Size in Print).