html - 在 IE 中将鼠标悬停在 html 按钮上时焦点类型 css

标签 html css focus

在页面上,当我们在元素之间切换时,它们会获得焦点,并且这些元素会通过一些浏览器特定的 css 突出显示。

在聚焦时点赞按钮显示如下图所示。

Notice the white dotted line on button

enter image description here

我想在按钮悬停时显示完全相似的内容

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/

相关文章:

html - 定制 Material 设计表格(前端)

html - 将内容固定到页面顶部

javascript - 使用 select2 时 Bootstrap popover 放置错误

html - 空白 : nowrap breaks flexbox layout

javascript - 如何使DIV无法聚焦?

javascript - 更改复选框字段的输入焦点和边距/填充

PHP:处理动态文件请求

CSS:将 Div 高度设置为 100% - 像素

php - CodeMirror - PHP 模式不起作用?

html - 在 Firefox 中将焦点设置到 iframe 正文/内容?