Sarežģīti selektori ar saišu stāvokļiem CSS

Visus sarežģītos selektorus, kurus mēs pētījām iepriekš, var izmantot arī saitēm.

Apskatīsim piemērā. Pieņemsim, ka mūsu saites atrodas blokā ar norādītu id:

html<div id="block">
  <a href="#">saites</a>
  <a href="#">saites</a>
  <a href="#">saites</a>
</div>

Uzstādīsim stilus saitēm no šī bloka:

css#block a:link, #block a:visited {
  color: red;
}
#block a:hover {
  text-decoration: none;
}

Parasti stāvokļus link un visited neatdala, tāpēc kodu var vienkāršot šādi:

css#block a {
  color: red;
}
#block a:hover {
  text-decoration: none;
}
Задание 1

Pastāstiet, ko izvēlas selektors dotajā kodā. Tad uzrakstiet HTML kodu, kas atbilst šim selektoram. Lūk, kods ar selektoru:

css#test a {
  color: red;
}
#test a:hover {
  text-decoration: none;
}