Introduction
Cascading Style Sheets (CSS) is a style sheet language for a document written in a markup language. It is widely used for defining layout or presentation of HTML documents.
A style sheet is made up of a set of rules
. A rule
or rule set
consists of a selector followed by a declaration block of property/value pair(s). For example, the below rule selects paragraph
elements followed by a declaration within braces made up of a property
(color) and its value
(red)
p {
color: red;
}
Each declaration ends with a semicolon. A single rule can have one or more declarations, placed inside braces for a selected element
p {
color: red;
font-size: 12px;
}
CSS rules can be applied inline via the style
attribute, or embedded within the style
element, or linked to an external stylesheet inside the link
element.