【问题标题】:How to remove blue-box-fill when clicking the buttons?单击按钮时如何删除蓝框填充?
【发布时间】:2020-11-06 21:47:08
【问题描述】:

这是我在设备上屏幕录制的 gif,您可以在其中看到我所说的蓝框填充:

我试过这样做:

* {
  user-select: none;
  -webkit-user-select: none; /* Safari */
  -khtml-user-select: none; /* Konqueror HTML */
  -moz-user-select: none; /* Firefox */
  -ms-user-select: none; /* Internet Explorer/Edge */
};

button, 
button:active, 
button:focus {
  outline: none;
};

但它并不能消除那个蓝框填充​​,因为它不是真正的焦点边框或outline

【问题讨论】:

标签: css


【解决方案1】:

您要查找的物业是tap-highlight-color

-webkit-tap-highlight-color: transparent;

【讨论】:

    【解决方案2】:

    我猜这发生在 iOS 上?

    这应该可以防止蓝框出现:

    -webkit-tap-highlight-color: transparent;
    

    【讨论】:

    • 感谢@doctypecode 的回答。但是不,它发生在所有操作系统上,而不仅仅是 iOS。
    【解决方案3】:

    我想你想要这样 ..

    button {
      margin: 10px;
      padding: 10px;
      height: 50px;
      width: 50px;
      background: #0095ff;
      border: none;
      border-radius: 40px;
      cursor: pointer;
      color: white;
    }
    
    #btn2 {
      outline: none;  
    }
    <button id="btn1">Click</button>
    <button id="btn2">Click</button>

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-08-05
      • 2018-04-03
      • 1970-01-01
      • 2016-11-02
      • 2015-02-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多