在页面上,当我们在元素之间切换时,它们会获得焦点,并且这些元素会通过一些浏览器特定的 css 突出显示。
在聚焦时点赞按钮显示如下图所示。
Notice the white dotted line on button
我想在按钮悬停
时显示完全相似的内容
button:hover {
/*What should go here?*/
}
最佳答案
这是您要找的吗? http://jsfiddle.net/Screetop/tpx5tyxc/ 正如其他人所提到的,请查看 outline 属性。 box-shadow 还模拟了按钮周围的边框。
<button>Submit</button>
button {
display: block;
background: grey;
padding: 5px;
border: none;
box-shadow: 0 0 0 3px grey;
}
button:hover {
/*What should go here?*/
outline: 1px dotted white;
}
button:focus {
outline: 1px dotted white;
}
关于html - 在 IE 中将鼠标悬停在 html 按钮上时焦点类型 css,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31401120/