From the course: CSS: Design Systems and Architectures

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Formatting rules

Formatting rules - CSS Tutorial

From the course: CSS: Design Systems and Architectures

Start my 1-month free trial

Formatting rules

- [Narrator] One way to make your CSS easier to maintain is to keep it tidy and organized. The code base should look like it's written by one person, even if it's maintained by many. It may seem nit-picky at first, but be sure to define all formatting and style rules and stick to them whether you're working alone or with others. Here are some rules I like to follow. Place the opening brace on the same line as the selector with the closing brace on it's own line. Properties should be indented once, with each property on it's own line. Add a space before the opening brace and after the colon following the property name. When grouping selectors, put each selector on it's own line. Use lowercase for all naming conventions, such as file names and class names with a dash for separating multiple words. These are just some examples for consistent formatting. You may agree or disagree with these rules. There's no right or wrong answer. Define your rules and stick to it. Consistency is key…

Contents