当我点击其他地方的边界消失,我试图使用onfocus: none,但这没有帮助。如何使这个丑陋的按钮边界消失时,我点击它?

输入(type =按钮){ 宽度:120 px; 高度:60 px; margin-left: 35 px; 显示:块; 背景颜色:灰色; 颜色:白色; 边界:没有; } <input type="button" value="Example button" >


当前回答

这对我来说很简单:)

*:focus {
    outline: 0 !important;
}

其他回答

使用outline: none;你可以在铬中删除边界。

<style>
input[type=button] {
    width: 120px;
    height: 60px;
    margin-left: 35px;
    display: block;
    background-color: gray;
    color: white;
    border: none;
    outline: none;
}
</style>

这比你想象的要简单得多。当按钮被聚焦时,应用outline属性,如下所示:

button:focus {
    outline: 0 !important;
}

但是当我使用none值时,它对我不起作用。

将按钮的轮廓和框影属性都设置为none,并使它们重要。

input[type=button] {
    outline: none !important;
    box-shadow: none !important;
} 

The reason for setting the values to **important** is that, if you are using other CSS libraries or frameworks like Bootstrap, it might get overridden.
button:focus{outline:none !important;}

如果在Bootstrap中使用,则重要

同样值得注意的是outline: none可以应用于<button>标签和input[type=button]来删除浏览器应用的单击边框。