Page 115 - CodePilot V5.0 C6
P. 115
The components of the CSS syntax are as follows:
Selector: This identifies the HTML element for CSS rules. Selectors can be grouped with commas
to style multiple tags. For example:
H1, H2, P {
COLOR: GREEN;
}
The above code snippet will change the text colour of all <H1>, <H2> and <P> elements to green.
Property: A property defines the style to apply, such as COLOR, FONT-SIZE or BACKGROUND-
COLOR.
Value: This is the setting or value assigned to the property. This could be a colour, size, position,
etc. For example, RED, 16PX, CENTER. Each property has its own valid set of values.
Declaration: This is a combination of a property and its value, written in the format property:
value;. For example: {COLOR: BLUE;}
Declaration Block: It is a set of one or more declarations enclosed in curly braces {}. Multiple
declarations inside the block are separated by semicolons. For example: {COLOR: RED;
FONT-SIZE: 16PX;}
For example:
Property Value Property Value
Declaration
Selector H1 {COLOR: RED; TEXT-ALIGN: CENTER;} Block
Declaration Declaration
So, when this code runs, all <H1> headings will appear red and centered on the page.
TYPES OF CSS
There are three main ways to add CSS to your web page:
Inline CSS
Internal CSS
External CSS
INLINE CSS
An Inline CSS is used to apply a unique style for a single element. Inline styles are added directly
to an HTML tag by using the STYLE attribute with the tag.
113
CSS3–Styling Basics

