894 B
894 B
title |
---|
Structure of CSS |
CSS Structure
A CSS rule follows this basic structure:
selector {
property: value;
property: value;
}
Everything inside the curly brackets styles whatever is selected by the selector. Inside a CSS rules is a set of property/value pairs.
You can have different selectors seperated with commas:
selector1,
selector2 {
property: value;
}
Multiple CSS rules can be put in one CSS file - here is an example:
h1 {
color: red;
}
div {
text-align: center;
color: blue;
}
img {
margin-left: 2px;
margin-top: 100px;
}
More Information:
- CSS Syntax on Code The Web
- More on CSS selectors
- More on CSS properties