W3.CSSLesson 36Free preview
W3.CSS Code Reuse
This lesson is part of W3.CSS · All levels
Summary
Reuse or reuse means writing a piece once and then using it multiple times, whether it's a CSS class, a theme variable, or a markup piece. This principle reduces duplication so repairs only need to be done in one place. A project that uses discipline to re-code will be much easier to maintain as the pages grow.
Key points
- DRY principle: Don't repeat the work that can be saved once
- The class components become the most basic way to re-style
- The CSS variable makes themes replaceable by slightly changing the value
- Separately stored markup pieces reduce manual copying
- Over-duplication makes every repair necessary to be repeated many times.
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.