My Second CSS Page
Cascading Style Sheets (CSS) is a style sheet language used to describe the presentation layer (that is, the look and formatting) of a document written in a markup language.
The Components of a CSS page
A style sheet consists of a list of rules. Each rule or rule-set
consists of one or more selectors and a declaration block. A
declaration-block consists of a list of declarations in braces. Each
declaration itself consists of a property, a colon (:
), a
value, then a semi-colon (;
)
Pseudo-classes are another form of specification used in CSS to
identify markup elements, and in some cases, specific user actions, to which a
particular declaration block applies. An often-used example is the :hover
pseudo-class that applies a style only when the user 'points to' the visible
element, usually by holding the mouse cursor over it. It is appended to a
selector as in a:hover
or #elementid:hover
. Other
pseudo-classes and pseudo-elements are, for example, :first-line
,
:visited
or :before
. A special pseudo-class is :lang(c)
,
"c".
-
Uses of CSS
Prior to CSS, nearly all of the presentational attributes of HTML documents were contained within the HTML markup; all font colors, background styles, element alignments, borders and sizes had to be explicitly described, often repeatedly, within the HTML. CSS allows authors to move much of that information to a separate style sheet resulting in considerably simpler HTML markup.
Prior to CSS, document authors who wanted to assign such typographic
characteristics to, say, all h2
headings had to use the HTML
font
and other presentational elements for each occurrence of
that heading type. The additional presentational markup in the HTML made
documents more complex, and generally more difficult to maintain. In CSS,
presentation is separated from structure. In print, CSS can define color,
font, text alignment, size, borders, spacing, layout and many other
typographic characteristics. It can do so independently for on-screen and
printed views