Cascading Style Sheets: Making Your Web Pages Look Beautiful
CSS stands for Cascading Style Sheets:
A CSS rule-set consists of a selector and a declaration block:
In the following example all <p>
elements will be center-aligned, with a red text color:
p {
color: red;
text-align: center;
}
CSS selectors are used to "find" (or select) HTML elements based on their element name, id, class, attribute, and more. Here are just a few ways to select HTML elements:
p {
color: red;
text-align: center;
}
#id-name {
color: red;
text-align: center;
}
.class-name {
color: red;
text-align: center;
}
p.class-name {
color: red;
text-align: center;
}