所以下面是我的代码。 css块中的“active”命令起作用,因为当点击div时它会改变颜色,但是当放开点击时,它的边框应该变成红色,如css块中的“target”命令所示,但它不会。想法?积极的作品,但不重点或目标使用css
<html>
<body>
<style type="text/css">
.svar-grid {
margin: 20px;
}
.svar-grid .svar {
padding: 10px;
text-align: center;
margin-top:20px;
width:100%;
border:2px solid black;
border-radius:10px;
background:yellowgreen;
}
.svar-grid .svar:active {
padding: 10px;
text-align: center;
margin-top:20px;
width:100%;
border:2px solid black;
border-radius:10px;
background:green;
}
.svar-grid .svar:target {
padding: 10px;
text-align: center;
margin-top:20px;
width:100%;
border:2px solid red;
border-radius:10px;
background:green;
}
</style>
<html>
<div>
<div class="svar-grid">
<div class="svar"><h4>Testing</h4></div>
</div>
</div>
我觉得你在做什么样的目标,https://developer.mozilla.org/en-US/docs/Web/CSS/:target都搞不清楚 – Huangism