Current Assignment(s)
A6: Color
Due: Recommended by Monday, 6.04
Due: Recommended by Monday, 6.04
Select and Declare
To “style” content in your HTML document you write style “rules” that apply to elements. These rules will always follow the same patterns.
Selector
The first part of every rule is a “selector” which tells the browser what element(s) the rule applies to. This is followed by a space, then a block, delineated with curly brackets.
CSS
/* ⬇ SELECTOR - selects all h1 elements */
h1 {
}
Declaration
The portion of the rule delineated by the curly brackets is known as the declaration. This tells the browser what to do to the selected element(s).
CSS
/* ⬇ SELECTOR - selects all h1 elements */
h1 {
/* ⬇ DECLARATION goes inside curly brackets. */
color: white;
}
- Previous
- Next