CHAPTER 26

image

Best practices

You now have an understanding of the fundamentals of CSS. This final chapter takes a step back to look at good coding practices and standards for style sheet development. Following these guidelines can help you write robust CSS code that is easy to maintain, reuse, and extend upon.

Reusable code

A key idea to a manageable style sheet is to avoid duplicate code. Classes help achieve this goal because they are reusable and can be combined in different ways, giving you a flexible design that is easy to evolve.

Any time you find page items that share style properties, you should consider combining those repeating patterns. ...

Get CSS Quick Syntax Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.