A Complete Guide to Web Design

(やまだぃちぅ) #1
Properties 407

CSS

Properties

Web Design in a Nutshell, eMatter Edition

text-indent


Values:
length|percentage


Example:
P.first { text-indent: 3em }


Applies to:
Block-level elements


Inherited:
Yes
This property specifies an amount of indentation (from the left margin) to
appear in the first line of text in an element. The value of text-indent may be
negative to create hanging-indent effects, although this feature is poorly
supported. Values can be specified in any available unit of length or as a
percentage of the line length.


Box Properties


Style sheets treat each element on a page as though it were contained within a
box (imagine four lines drawn against the edges of this paragraph). More accu-
rately, each element is in a series of containing boxes (see Figure 23-2), beginning
with the content itself, surrounded by padding, then the border, which is
surrounded by the margin.


The content itself is the element width. A background applied to an element will
extend into the padding, but not beyond the border. The box width extends to the
outside edges of the margin. The boundary of the margin is not visible but is a
calculated amount.


The CSS1 provides many properties for controlling the presentation of an
element’s box, including setting the amount of padding and margin, the appear-
ance of the borders, and the background color (discussed in the next section). The
box model is also the basis for absolute positioning (discussed later in this


Figure 23-2: The box formatting model for page elements.


margin

border

box width

element width

This is the content
of the box.

padding
Free download pdf