A sheet file consist of a list
of rules.
Each rule consists of:
In CSS, selectors are used to declare
which elements can applies to, a kind of match
expression. Here are some example of selector syntax:
All elements: that is, using the * elector
By element name:
e.g. for all p or h2
elements
Descendants:
e.g. for an element that are descendants of li
elements (e.g links inside lists) the selector is
li a
class or id
attributes: e.g.#id and/or .class
for elements with class="class" or id="id"
Adjacent elements:
e.g. for all p elements preceded by h2 element, the
selector would be h2 + p
Direct child
element: e.g. for all elements inside p,
but no elements deeper within the hierarchy,
the selectors would be p > span
By attributes:e.g. for all <input type="text">
the selector would be input[type="text"
Each declaration consist of a
property, a colon : and a value.
|