Essential
Guide your visitors' eyes with a strong visual hierarchy. Use size, color, and spacing to highlight important elements.
h1 { font-size: 3rem; font-weight: 800; }
h2 { font-size: 2rem; font-weight: 700; }
h3 { font-size: 1.5rem; font-weight: 600; }
p { font-size: 1rem; line-height: 1.7; }
Typography
Layout
Essential
Images often represent 50%+ of a page's weight. Use WebP, lazy loading, and srcset for significant performance gains.
<img
src="image.webp"
loading="lazy"
decoding="async"
srcset="image-400.webp 400w,
image-800.webp 800w"
sizes="(max-width: 600px) 400px, 800px"
/>
Images
Core Web Vitals
Important
Prioritize transform and opacity for smooth 60fps animations. Avoid animating width, height, top, left which trigger costly repaints.
.element {
transform: translateX(100px);
opacity: 0.5;
}
.element {
left: 100px;
width: 200px;
}
CSS
Performance
Important
Centralize your colors, spacing, and typography with CSS custom properties. Simplify maintenance and enable theming.
:root {
--primary: #6366f1;
--text: #ffffff;
--bg: #0a0a0f;
--space-sm: 8px;
--space-md: 16px;
--space-lg: 32px;
--radius: 12px;
}
Design System
Maintenance
Essential
Ensure a minimum contrast ratio of 4.5:1 for normal text and 3:1 for large text. Use tools like WebAIM to verify.
.text {
color: #ffffff;
background: #1a1a1a;
}
.text {
color: #888888;
background: #666666;
}
WCAG
Couleurs
Important
On mobile, touch targets must be at least 44x44 pixels to be easily clickable. This is a recommendation from Apple and Google.
.button {
min-height: 44px;
min-width: 44px;
padding: 12px 24px;
}
.icon-button {
width: 44px;
height: 44px;
display: flex;
align-items: center;
justify-content: center;
}
Mobile
Touch
Essential
Use semantic HTML5 tags (header, main, nav, article, section, footer) to help search engines understand your content.
<header>
<nav>...</nav>
</header>
<main>
<article>
<h1>Main title</h1>
<section>...</section>
</article>
</main>
<footer>...</footer>
HTML5
Structure
Bonus
Some users are sensitive to animations. Disable or reduce animations for those who enabled this system preference.
.element {
animation: slideIn 0.5s ease;
}
@media (prefers-reduced-motion: reduce) {
.element {
animation: none;
transition: none;
}
}
Accessibility
Media Query
Important
Use preload to prioritize loading essential resources like fonts, critical CSS, and above-the-fold images.
<link rel="preload" href="font.woff2"
as="font" crossorigin>
<link rel="preload" href="critical.css"
as="style">
<link rel="preload" href="hero.webp"
as="image">
LCP
Fonts
Important
The clamp() function lets you define fluid values with minimum and maximum. Perfect for responsive typography and spacing.
h1 {
font-size: clamp(2rem, 5vw, 4rem);
}
.section {
padding: clamp(40px, 8vw, 100px);
}
.container {
width: clamp(300px, 90%, 1200px);
}
Responsive
Fluid Design
Essential
Users must always know their action was received. Add hover, active, loading, and success states to your buttons.
.btn {
transition: all 0.2s;
}
.btn:hover {
transform: translateY(-2px);
}
.btn:active {
transform: scale(0.98);
}
.btn.loading {
opacity: 0.7;
pointer-events: none;
}
.btn.success {
background: #10b981;
}
Micro-interactions
States
Important
Every informative image should have alt text describing its content. It's essential for accessibility and SEO.
<img src="team.jpg"
alt="Equipe de 5 developpeurs
travaillant ensemble">
<img src="team.jpg" alt="image">
<img src="decoration.svg" alt="" role="presentation">
Images
Accessibility
Bonus
Use prefers-color-scheme to automatically adapt your site to the user's system preferences.
:root {
--bg: #ffffff;
--text: #1a1a1a;
}
@media (prefers-color-scheme: dark) {
:root {
--bg: #0a0a0f;
--text: #ffffff;
}
}
body {
background: var(--bg);
color: var(--text);
}
Dark Mode
Media Query
Essential
CLS degrades user experience. Reserve space for images and dynamic content to avoid layout shifts.
.image-container {
aspect-ratio: 16 / 9;
background: #1a1a1a;
}
.image-wrapper {
position: relative;
padding-bottom: 56.25%;
}
.image-wrapper img {
position: absolute;
inset: 0;
}
Core Web Vitals
Layout
Important
Simplify your forms: one field per line, visible labels, real-time validation, and clear, helpful error messages.
<label for="email">Email</label>
<input
type="email"
id="email"
required
autocomplete="email"
inputmode="email"
placeholder="you@example.com"
/>
<span class="error">
Please enter a valid email
</span>
Forms
Validation
Important
Never remove the focus outline. Customize it to be visible while integrating with your design.
*:focus { outline: none; }
:focus-visible {
outline: 2px solid var(--primary);
outline-offset: 2px;
}
:focus:not(:focus-visible) {
outline: none;
}
Keyboard
Navigation