![]() |
Lesson 1
Each has a selector--usually an HTML element such as BODY, P, or EM--and the style to be applied to the selector.
Within each element you must apply properties to it. Each property takes a value . The following example describes it much better.
Style Format:
selector { property: value }
You can also declare multiple style declarations for a single selector:
selector { property1: value1; property2: value2
}
As an example, the following code segment defines the color and font-size properties for H1 and H2 elements:
<HEAD> <TITLE>CSS Example</TITLE> <STYLE TYPE="text/css">H1 { font-size: x-large; color: red } H2 { font-size: large; color: blue }</STYLE> </HEAD>
The above style sheet tells the browser to show level-one headings in an extra-large, red font, and to show level-two headings in a large, blue font.
![]() |