CSS - Pseudoklassen kombinieren?

N

Netzwerkidi

Hallo,

ich habe ein Problem mit CSS.

Im aktuellen Fall ist a:link definiert und a:before.

Nun soll sich aber bei a:hover auch a:before ändern, aber das scheint ohne JS nicht zu klappen, korrekt?
Code:
a:link {color: red}
a:before {content: "red before"}
a:hover a:before {color:blue; content: "blue before"} /* scheint nicht zu gehen */
Beste Grüße

Idi
 
Hallo,

das Problem ist, dass er die Änderung - im Beispiel die Borderline - dann nur für den "before"-Part macht.

Code:
#d1 ul li a:before {
  border-bottom: none; 
  content: "\25BA \a0"; 
}
#d1 ul li a:hover:before {
  border-bottom: 5px solid #aaa; 
  content: "\25BC \a0";
}
 
Zuletzt bearbeitet von einem Moderator:
Dann machst du es eben so:
CSS:
a:before {
  border-bottom: none;
  content: "\25BA \a0";
}
a:hover, a:hover:before {
  border-bottom: 5px solid #aaa;
  content: "\25BC \a0";
}
 

Neue Beiträge

Zurück