答案 0 :(得分:0)
使用css :target
选择器
a {
color:black
}
* {
text-align: center;
}
div#myTarget:target, div#myOtherTarget:target {
color: red;
}
<a href="#myTarget">Click to target #myTarget</a><br>
<a href="#myOtherTarget">Click to target #myOtherTarget</a>
<br><br>
<div id="myTarget">#myTarget</div>
<div id="myOtherTarget">#myOtherTarget</div>