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 - CSS Tutorial
From the course: CSS: Design Systems and Architectures
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
-
-
-
-
-
(Locked)
Overview1m 32s
-
(Locked)
Defining the stages and categories4m 40s
-
(Locked)
Editor settings, tools, and setup2m 21s
-
(Locked)
Formatting rules1m 50s
-
(Locked)
Class-based CSS1m 39s
-
(Locked)
Naming conventions with SMACSS3m 6s
-
(Locked)
Base styles3m 6s
-
(Locked)
Modular CSS3m 25s
-
(Locked)
Responsive2m 16s
-
(Locked)
Templates1m 31s
-
(Locked)
-