我可以使用 css 执行此操作吗?我尝试使用 :active 选择器,但它不适用于 iframe。有没有其他方法让它看起来像这样?
<style>
a.lis:active {
background-color: #4CAF50;
}
a.lis {
color: white;
font-size: 19px;
text-align: center;
font-weight: 10px;
text-decoration: none;
margin-bottom: 0px;
float: left;
disply: inline-block;
height: 30px;
background-color: #5F5F5F;
padding: 14px 10px 10px 5px;
}
a.lis:hover {
background-color: #4CAF50;
}
</style>
<ul class="list">
<li class="icolist">
<img class="icohome" src="home.png" width="25px" height="25px" target="ifrm">
</li>
<li><a target="ifrm">Best places</a>
</li>
<li><a class="lis" href="http://localhost/signup.php" target="ifrm">Hotels</a>
</li>
<li><a class="lis" href="#" target="ifrm">Videos</a>
</li>
<li><a class="lis" href="#" target="ifrm">Best routes</a>
</li>
</ul>
最佳答案
我解决了这个问题,我使用了 :focus selector for links,它运行良好。感谢所有给出答案的人
关于html - 在 iframe 中打开链接时如何使背景色变为绿色?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37358589/