The general format of CSS:
Let's discuss the general format of CSS.
The general format CSS contains two parts in style rule i.e. selector and property:
value. The selector determines what HTML tag we are styling, and the declaration is made up of one or more property: value pairs, ending in a
semi-colon and enclosed in curly brackets.
In this case, a property is a display feature such as color and value is what we want that property to look like.
selector{property:value}
selector{property:value;property:value;property:value;...........}
Where,
selector : Normal HTML element/tag you wish to define. It is the link
between the HTML document and the style sheet.
property: The attribute of the tag intended to change.
Example:
1.body{color:green}
In this color attribute of the body, the element
is set to green.
- Every CSS definition has to have a selector and a declaration. The declaration follows the selector and uses curly braces.
- The declaration consists of one or more properties separated with a semicolon.
- Every property has a name, colon, and value.
- A property can have multiple values separated with a comma.
- Along with value, can also be a unit of measure.No space is allowed between the value and the unit.
- When writing CSS code, you can use white space as needed-new lines, spaces, whatever makes your code more readable.
No comments:
Post a Comment