1 回答
TA贡献1865条经验 获得超7个赞
function removeBorder(){
li=document.getElementById("link");
li.classList.add(".remove")
}
body{
background:#dddddd;
}
p:focus{
border:1px solid red;
}
li{
list-style-type:none;
font-size:1rem
padding:30px;
}
a{
text-decoration:none;
}
a:focus:hover{
border:1px solid red;
border-radius:2px;
}
a:hover{
background:orange;
}
.remove{
border:none;
}
<html>
<head>Borders
</head>
<body>
<p tabindex="0">
Click one the page. Then use TAB to navigate the list items</p>
<ul aria-role="list">
<li aria-role="listitem"><a id="link" onclick="removeBorder()" tabindex="0" href="#">Item One</a></li>
<li aria-role="listitem"><a tabindex="0" onclick="removeBorder()" href="#">Item Two</a></li>
<li aria-role="listitem"><a tabindex="0" onclick="removeBorder()" href="#">Item Three</a></li>
</ul>
</body>
</html>
您应该同时添加焦点和悬停,它可以工作。
- 1 回答
- 0 关注
- 80 浏览
添加回答
举报