A CSS rule set consists of a Selector and Declaration Block.
A CSS selector always points to the HTML element.
The declaration block contains one or set of declarations.
Each declaration includes a property name and a value to that property, separated by a colon.
Different declarations are separated by semi colons.
e.g.,
The declaration block contains one or set of declarations.
Each declaration includes a property name and a value to that property, separated by a colon.
Different declarations are separated by semi colons.
e.g.,
p {
color: red;
text-align: center;
}
It's the only matter of style, the above mentioned code can be written as follows too:
p {
font-family: 'Arial';
color: red;
}
Both will work as same.
CSS Comments:
Comments, in any programming language, are used to understand the code. Like other languages, comments are being used in CSS too.
Each CSS comment line starts with /* and ends with */.
/* and */ can also contain muli line comments.
e.g.,
/* and */ can also contain muli line comments.
e.g.,
p {
color: red;
/* this is a single line commnet */
text-align: center;
/* this is a
multi-line comment */
}
You can download the example file here:
Post a Comment
Suggestions will be greeted.