Hoofdstuk 1 · Onderdeel 4
Kleur is een van de krachtigste middelen om een website herkenbaar, functioneel en toegankelijk te maken. In CSS beheer je tekstkleur met color en de achtergrond met background-color.
De 4 Kleurnotaties in CSS:
1. Hexadecimaal (Hex) — Standaard
Begint met # en 6 tekens (Rood, Groen, Blauw in hex 00-FF).
color: #2563eb;
2. RGB / RGBA
Waarden van 0 t/m 255. Optionele Alpha (transparantie 0.0 tot 1.0).
background: rgba(37, 99, 235, 0.1);
3. HSL / HSLA
Hue (0-360 kleurwiel), Saturation (verzadiging %), Lightness (helderheid %).
color: hsl(217, 91%, 60%);
4. Kleurnamen
Ongeveer 140 vaste namen (zoals white, black, red). Handig voor snelle tests.
color: navy;
⚡
Interactieve Opdracht: 06_css_h1_transparantie_blanks
Invuloefening (Blanks)
CSS 1.1 · Kleurwaarden & Contrast
RGBA Transparantie & Kleurcontrast
Bekijk het CSS-declaratieblok voor een semi-transparante kaart in overlay.css en vul de 3 ontbrekende waarden in:
🎨 overlay.css
src > overlay.css
—
✕
1
/* Transparante overlay kaart met wit contrast */
3
background-color: [ 1 ](15, 23, 42, [ 2 ]);
ℹ️ rgba = Red Green Blue Alpha (dekking tussen 0.0 en 1.0).
Vul de gevraagde eigenschappen en waarden in:
⚡ Interactieve Controle & Toetsing
Fill in the Blanks
💡 Toon Uitwerking & Gecorrigeerde Code (Naslagwerk)
Uitklappen ▾
Oplossingen per Positie:
Positie [ 1 ] Juiste Oplossing:
rgba
Rood Groen Blauw Alpha
Positie [ 2 ] Juiste Oplossing:
0.5/.5
Decimale alpha waarde voor 50% dekking (0.5)
Positie [ 3 ] Juiste Oplossing:
#ffffff/#FFFFFF
Hexadecimale kleurcode voor wit (#ffffff)
✅ Gerepareerde Code: RGBA Transparantie & Contrast
overlay.css
2
background-color: rgba(15, 23, 42, 0.5); /* ➕ 50% transparant donkerblauw */
3
color: #ffffff; /* ➕ Maximaal wit contrast */
💡 Actief leren: Probeer altijd eerst zelfstandig de opdracht op te lossen voordat je uitklapt.
✓ Direct interactief in dit hoofdstuk