Structure of CSS – CSS


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:

This article needs improvement. You can help improve this article. You can also write similar articles and help the community.