誰かが次のことが起こる理由を説明できますか?
<a href="#" class="test">Test</a>
<style type="text/css">
.test {
border: thin solid blue;
color: red;
}
</style>
これは境界線を作成するだけで、クラスを使用するときにテキストを赤くすることはありません。
ただし、これは、代わりにIDを使用するときにテキストを赤に変える場合に機能します。
<a href="#" id="test">Test</a>
<style type="text/css">
#test {
border: thin solid blue;
color: red;
}
</style>
idを使用しても機能するのに、クラスがテキストの色を変更しないのはなぜですか?
ありがとう!