Just like HTML, CSS follows certain best practices for spacing and indentation.
One space should be used between the selector and the opening curly brace (
No extra spaces should exist between opening and closing curly braces (
}) and CSS declarations (as in the example above).
Two spaces of indentation should be used for CSS declarations.
One line of spacing should exist between CSS rules. In the example above, there is one line of spacing between the CSS rule for the heading and the CSS rule for the paragraph.
CSS files can become lengthy as styling is added to a web page. Proper spacing and indentation helps keep CSS code maintainable and readable for you and other developers.