Lie, H. W. (1994). Cascading HTML style sheets: a proposal. World Wide Web Consortium (W3C).
Lie, H. W., & Bos, B. (2005). The CSS saga. In Cascading style sheets: Designing for the web. Addison-Wesley Professional.
CSS is used to define the look and formatting of content.
HTML is used to define the semantics of the content, without look and formatting or "presentation"
Versions
A style sheet is a list of rules
Each rule is a selector followed by a declaration block
selectors
determine which parts of the DOM tree are affected
DOM tree selector
refers to all elements of same type, or
elements with a particular local tree structure
e.g. p {color:red;} makes all paragraphs red
class selector
refers to all elements in a user defined class
e.g. .myclass {background:blue;} makes all elements in the "myclass" class have blue background
ID selector
refers to all elements with a user defined ID
e.g. #myelt {color:yellow;} makes the element labeled "myelt" yellow
pseduo class selector
refers to element characteristics outside of the DOM, often dynamic characteristics
e.g. hover, visited
these can often be combined
declaration blocks
each block is a list of property : value pairs
separate pairs by semicolons
example properties
color
background
Styles come from
Browser defaults
User defined styles
Author defined styles, in
external files
This is how you can centralize your styles, applying the same style to all your documents
Use the link element in your