Tag 2: Farben, Schriftarten & Text

Ziel

Lerne, wie du das Aussehen von Text mit Farben, Schriftarten und Abständen steuerst.

Themen

Farbbeispiele

p {
  color: blue;           /* benannter Farbwert */
}

h1 {
  color: #FF5733;        /* Hex-Code */
}

span {
  color: rgba(255, 0, 0, 0.7); /* rgba mit Transparenz */
}

Schrift-Beispiele

body {
  font-family: 'Arial', sans-serif;
  font-size: 16px;
}

h2 {
  font-weight: bold;
}

Textausrichtung & Dekoration

h1 {
  text-align: center;
}

p.underline {
  text-decoration: underline;
}

p.strikethrough {
  text-decoration: line-through;
}

Zeilenhöhe & Buchstabenabstand

p {
  line-height: 1.8;
  letter-spacing: 1px;
}

Übung

Beispiel HTML mit CSS

<!DOCTYPE html>
<html lang="de">
<head>
  <meta charset="UTF-8">
  <title>CSS Tag 2 Übung</title>
  <style>
    h1 {
      text-align: center;
      font-weight: bold;
      color: #2E86C1;
    }

    p {
      color: rgb(100, 100, 200);
      font-family: 'Georgia', serif;
      font-size: 18px;
      line-height: 1.8;
      letter-spacing: 1px;
    }

    p.underline {
      text-decoration: underline;
    }

    p.strikethrough {
      text-decoration: line-through;
    }
  </style>
</head>
<body>

  <h1>CSS Styling Grundlagen</h1>
  <p>Dies ist ein normal gestalteter Absatz.</p>
  <p class="underline">Dieser Absatz ist unterstrichen.</p>
  <p class="strikethrough">Dieser Absatz hat eine Durchstreichung.</p>

</body>
</html>