CSS follows a rule-based structure. Each rule consists of a selector and a declaration block. Selectors pick the HTML elements, while declaration blocks contain pairs of properties and values.
The general syntax for writing CSS.
selector {
property: value;
}
Note: Semi-colon (;
) at the end of each new property and property value is IMPORTANT.
h2{
color: blue;
}
Within the declaration block, there can be multiple pairs of properties and values.
button{
color: white;
background-color: black;
border: transparent;
border-radius: 5px;
}
;
".