HTML and CSS Reference
In-Depth Information
It looks like you're getting
the hang of this style stuff.
We're looking forward to seeing
what you come up with in the next
couple of chapters.
CSS contains simple statements, called rules.
Each rule provides the style for a selection of HTML
elements.
The <link> element is used to include an external
stylesheet.
Many properties are inherited. For instance, if
a property that is inherited is set for the <body>
element, all the <body>'s child elements will inherit it.
A typical rule consists of a selector along with one or
more properties and values.
You can always override properties that are inherited
by creating a more specific rule for the element you'd
like to change.
The selector specifies which elements the rule
applies to.
Each property declaration ends with a semicolon.
All properties and values in a rule go between { }
braces.
Use the class attribute to add elements to a class.
Use a “.” between the element name and the class
name to select a specific element in that class.
You can select any element using its name as the
selector.
Use “.classname” to select any elements that belong
to the class.
By separating element names with commas, you can
select multiple elements at once.
You can specify that an element belongs to more
than one class by placing multiple class names in the
class attribute with spaces between the names.
One of the easiest ways to include a style in HTML is
the <style> tag.
You can validate your CSS using the W3C validator,
at http://jigsaw.w3.org/css-validator.
For HTML and for sites of any complexity, you should
link to an external stylesheet.
Search WWH ::




Custom Search