Farbe automatisch ändern-CSS/HTML?

1 Antwort

Hintergrund ist background-color, Schriftfarbe ist color. Du willst letzteres, also einfach

h1 {
  color: red;
}

Oder willst du dass die Farbe dauerhaft hin- und her wechselt, beispielsweise von blau zu rot zu blau zu rot, etc.?

Falls du sowas willst brauchst du eine CSS Animation:

h1 {
  color: blue;
  animation: colorChange 1s infinite;
}

@keyframes colorChange {
  50% { color: red; }
  100% { color: blue; }
}
Woher ich das weiß:Hobby – Programmieren ist mein Hobby & Beruf