Quiz Entry - updated: 2026.07.14
What is the separation of concerns principle in web development?
Separation of concerns means splitting a web page into three independent layers — structure (HTML), presentation (CSS), and behaviour (JavaScript) — so each can change without disturbing the others.
A helpful analogy is a newspaper. The reporter writes the words (content), an editor arranges the columns, headlines and images into a sensible layout (structure), and the corporate design — fonts, colours, the masthead — is decided once and reused across every issue (presentation). Web development works the same way:
| Layer | Technology | Role |
|---|---|---|
| Structure | HTML | Content and its semantic meaning |
| Presentation | CSS | Visual styling and layout |
| Behaviour | JavaScript | Interactivity and logic |
Why bother keeping them apart?
- Maintainability: you can restyle a whole site by editing CSS, never touching the content.
- Reusability: one CSS file can dress hundreds of HTML pages identically.
- Accessibility: the content still reads sensibly even if styling fails to load.
- Team collaboration: a designer and a content author can work in parallel.
The classic mistake is mixing layers, for example baking colours straight into the markup:
<!-- Mixing content and presentation - hard to maintain -->
<p style="color: red; font-size: 16px;">Text</p>
<!-- Separated - the look lives in CSS, keyed off a class name -->
<p class="highlight">Text</p>