CSS Structure and Formatting of a CSS Rule

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Extensions
> Step 2: And Like the video. BONUS: You can also share it!

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; }


Got any CSS Question?