Gunnar Bittersmann: Attributvergabe in CSS

Beitrag lesen

@@MrMurphy

th.Land,
td.Land {
     text-align:left;
}

Das zweimalige Vorkommen der Klasse in der Selektorenliste ist nicht so gut. DRY!

Das lässt sich vermeiden: wie gezeigt mit Nesting oder mit :is():

:is(th, td).Land {
  text-align: left;
}

Die Frage steht noch im Raum, ob man den Elementtypen da braucht oder ob es nicht einfach

.Land {
  text-align: left;
}

auch tut.

🖖 Live long and prosper

--
“In my home, the America I love, the America I've written about, that has been a beacon of hope and liberty for 250 years, is currently in the hands of a corrupt, incompetent and treasonous administration. Tonight, we ask all who believe in democracy and the best of our American spirit, to rise with us, raise your voices against authoritarianism, and let freedom reign.”
— Bruce Springsteen, Manchester 2025-05-14