我有一個非常簡單的元素,其中包含一些文本或鏈接。將鼠標懸停在元素上時更改文本和鏈接的顏色
我想要在將元素懸停時更改文本顏色和鏈接顏色。我無法讓它工作,我認爲這是因爲你不能選擇2個僞類。我如何得到這樣的工作?
CSS:
.test, .test a:link, .test a:visited {
color: white;
text-decoration: none;
}
.test:hover, .test:hover .test a:link, .test:hover .test a:visited {
color: yellow;
text-decoration: none;
}
HTML:
<div class="test">
testtext<br>
<a href="#">testlink</a>
</div>
使用''#id選擇,而不是類 –
@NenadVracar不能解決問題。這個例子是打字錯誤。 –