Professional CSS Composition Guide
How to think about CSS on a real, professional website
This guide explains:
- Which CSS rules matter most in professional projects
- How and why to reset CSS
- Parent–child relationships and selector thinking
- What should be global vs local
- How CSS contributes to brand voice, not just layout
Framework-agnostic and teaching-oriented.
1. How professionals think about CSS (mental model)
Professionals think of CSS in layers, not files:
1. Reset / Normalization
2. Design tokens (brand rules)
3. Base element styles
4. Layout rules
5. Component styles
6. Page-specific overrides
Side note:
If everything lives at the same level, CSS becomes fragile and unpredictable.
2. Resetting CSS (foundational and critical)
Why reset CSS?
Browsers apply their own default styles.
A reset ensures consistent behavior across browsers.
Minimal professional reset (recommended)
*,
*::before,
*::after {
box-sizing: border-box;
}
* {
margin: 0;
padding: 0;
}
body {
line-height: 1.5;
-webkit-font-smoothing: antialiased;
}
Side note:
This is often enough. Full resets are usually overkill.
Normalize-style additions
img {
max-width: 100%;
display: block;
}
button,
input,
textarea {
font: inherit;
}
Side note:
Normalize when you want sensible defaults, reset when you want full control.
3. Global CSS (brand & identity layer)
These styles define the visual voice of the site.
:root {
--color-primary: #000000;
--color-secondary: #ffffff;
--color-accent: #0066cc;
--font-base: system-ui, sans-serif;
--font-heading: system-ui, sans-serif;
--spacing-xs: 0.25rem;
--spacing-sm: 0.5rem;
--spacing-md: 1rem;
--spacing-lg: 2rem;
}
Side note:
CSS variables are the backbone of maintainable design systems.
4. Base element styles (HTML-aware CSS)
body {
font-family: var(--font-base);
color: var(--color-primary);
background-color: var(--color-secondary);
}
h1, h2, h3 {
font-family: var(--font-heading);
}
a {
color: var(--color-accent);
text-decoration: none;
}
a:hover {
text-decoration: underline;
}
button {
cursor: pointer;
}
Side note:
If every element needs a class, base styles are missing.
5. Parent–child relationships in CSS
Direct child
nav > ul {
list-style: none;
}
Descendant
article p {
margin-bottom: var(--spacing-md);
}
Adjacent sibling
h2 + p {
margin-top: var(--spacing-sm);
}
Side note:
Professional CSS uses structure first, classes second.
6. Component styling (isolated and reusable)
.card {
padding: var(--spacing-md);
border-radius: 0.5rem;
background-color: white;
}
.card__title {
margin-bottom: var(--spacing-sm);
}
Side note:
Good components don’t leak styles or depend on page context.
7. Layout CSS (separate from components)
.page {
display: grid;
grid-template-columns: 1fr 3fr;
gap: var(--spacing-lg);
}
Side note:
Layout answers where, components answer what.
8. Global vs local CSS
Usually global
- Fonts
- Colors
- Spacing scale
- Headings
- Links
- Base buttons
Usually local
- Cards
- Forms
- Modals
- Page layouts
- Visual variations
Side note:
If a style appears on multiple pages, consider making it global.
9. CSS specificity (professional discipline)
Prefer
.button {}
.card {}
Avoid
body main section article .card button {}
Side note:
If you need !important, the architecture is probably wrong.
10. Brand voice through CSS
Brand is communicated through:
- Spacing (tight vs airy)
- Border radius (sharp vs soft)
- Motion (none vs subtle)
- Typography hierarchy
button {
border-radius: 0.25rem;
}
Side note:
CSS expresses personality just as much as copywriting.
Final professional checklist
✔ Reset or normalize
✔ Global design tokens
✔ Base styles for semantic HTML
✔ Layout separated from components
✔ Minimal specificity
✔ Brand consistency via globals
Final side note:
Good CSS is about clarity, predictability, and teaching the browser what matters most.