i

Learn HTML and CSS in 10 Days

CSS Coding Practices

Same as that in HTML, the coding practices done in CSS mainly focuses on keeping code well organized and lean. In addition to that, CSS also has some extra standards in regards to how to function with a portion of the complexities of the language.

Organize Code with Comments

CSS records can turn out to be very broad, traversing many lines. These big files can enable editing and finding our styles almost impossible. How about we keep our styles sorted out in consistent group. Before each group, just provide a comment keeping in mind that what the following styles pertain to.

Bad Code

header { ... }

article { ... }

.btn { ... }

Good Code

/* Primary header */

header { ... }

/* Featured article */

article { ... }

/* Buttons */

.btn { ... }