HTML and CSS Reference
In-Depth Information
Selecting elements
CSS consists of a set of stylistic properties that should be applied to a set of elements. The
following is an example of two properties being applied to all elements of type footer :
footer {
font-size: 12px;
text-align:center;
}
As with jQuery, you can specify rules for elements with specific classes:
.classname {
}
With specific IDs:
#idvalue {
}
Or with pseudo classes (the jQuery equivalent of filters):
a:visited {
}
As with jQuery, you can also combine multiple rules in the same selector. This will match
all td elements inside a table with the ID tblOne :
#tblOne td {
}
While this will match all td elements that have the class underlined :
.underlined.td {
}
All matched elements will have the styles specified applied to them, and as we will see be-
low, these styles will sometimes be inherited by their children.
Elements can be styled by more than one set of rules. For instance, if we have a footer
defined as follows:
<footer class=”myfooter” id=”footer1”>
And the following rules:
footer {
color:black;
Search WWH ::




Custom Search