Structure and Formatting of a CSS Rule

suggest change

Remarks

For ease of readability, keep all declarations indented one level from their selector, and the closing curly brace on its own line. Add a single space after selectors and colons, and always place a semicolon after the final declaration.

Good

p {
    color: maroon;
    font-size: 16px;
}

Bad

p{
 color: maroon;
font-size:16px }

One-Liner

If there are only one or two declarations, you might get away with this one. Not recommended for most cases. Always be consistent when possible.

p { color: maroon; font-size: 16px; }

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents