QUIZ – Wer hat das letzte Wort?

Elf Fragen zu CSS-Kaskade, Vererbung, Reihenfolge und Spezifität. Pro Frage eine oder mehrere Antworten ankreuzen und prüfen.


Punkte: 0 /

01. body vs. p

<h1>Überschrift</h1>
<p>Absatz</p>

body {
    color: red;
}

p {
    color: blue;
}
Welche Aussagen stimmen?

02. gleicher Selektor

p {
    color: red;
}

p {
    color: blue;
}
Welche Farbe hat der Absatz?

03. zwei CSS-Dateien

<link href="red.css" rel="stylesheet">
<link href="blue.css" rel="stylesheet">

/* red.css */
p { color: red; }

/* blue.css */
p { color: blue; }
Welche Datei hat das letzte Wort?

04. zwei CSS-Dateien, umgekehrt

<link href="blue.css" rel="stylesheet">
<link href="red.css" rel="stylesheet">

/* blue.css */
p { color: blue; }

/* red.css */
p { color: red; }
Welche Farbe hat der Absatz?

05. style vor link

<style>
  p { color: red; }
</style>

<link href="style.css" rel="stylesheet">

/* style.css */
p { color: blue; }
Was gewinnt?

06. link vor style

<link href="style.css" rel="stylesheet">

<style>
  p { color: red; }
</style>

/* style.css */
p { color: blue; }
Welche Farbe hat der Absatz?

07. body, main, p

<main>
    <h1>Überschrift</h1>
    <p>Absatz</p>
</main>

body { color: red;   }
main { color: blue;  }
p    { color: green; }
Welche Aussagen stimmen?

08. Klasse gegen Element

<p class="intro">Absatz</p>

p {
    color: red;
}

.intro {
    color: blue;
}
Welche Farbe hat der Absatz?

09. vererbbar oder nicht?

body {
    color: red;
    margin: 20px;
    font-size: 1.2rem;
    background: yellow;
}
Welche Eigenschaften werden an Kindelemente vererbt?

10. ID gegen Klasse gegen Element

<p id="special" class="intro">Absatz</p>

p        { color: blue;  }
.intro   { color: red;   }
#special { color: green; }
Welche Farbe hat der Absatz?

11. !important

p { color: blue !important; }
p { color: red; }
Welche Farbe hat der Absatz?