首页 > 解决方案 > css为什么点击按钮后有边框?

问题描述

当我单击按钮时,会显示一个边框。我怎样才能删除这个边界,为什么它在那里?

这是CSS代码:

.operator button {
margin: 3px;
/*height: 25px;
width: 25px;*/  
border-radius: 50%;
background-color: green;
border: none; 
font-size: 10px;
padding: 12px 12px;
border: 2px solid #4CAF50;
transition-duration: 1s;
text-align: center;
display: inline;
 }

[这是一张图片1

标签: cssbutton

解决方案


添加outline: 0;您的button:focus

.operator button {
    margin: 3px;
    /*height: 25px;
    width: 25px;*/  
    border-radius: 50%;
    background-color: green;
    border: none; 
    font-size: 10px;
    padding: 12px 12px;
    border: 2px solid #4CAF50;
    transition-duration: 1s;
    text-align: center;
    display: inline;
}

.operator button:focus { outline: 0; }
<div class="operator">
  <button>Test</button>
</div>

您可能也想阅读此内容:https ://stackoverflow.com/a/25298082/9718056


推荐阅读