提问者:小点点

Microsoft Edge(83.0.478.56)的新版本无法覆盖用户代理样式


在我的网站上,我有CSS样式,防止在输入或文本上有边框。 这在Firefox,Chrome以及直到最近的微软Edge上都能运行。 随着Edge的最新更新,聚焦的输入和文本都有了边框,边框来自“用户代理样式”。 下面是一个例子:

https://jsfiddle.net/da6meyhb

<div>
   <textarea class="style1" rows="10">Hello World!</textarea>
</div>

textarea.style1,
textarea.style1:focus,
textarea.style1:hover {
  background-color: aqua;
  border-style: none;
  border-width: 0px;
  border-radius: 0px;
  resize: none;
}

此示例有一个文本区域,使用CSS样式来防止边框。 在新版本的Microsoft edge(83.0.478.56)中,当聚焦时,文本区域仍然有黑色边框。

如何禁用此边框?


共1个答案

匿名用户

正如CBroe所说的,Chrome浏览器也存在同样的问题,然后把焦点放在文本区域上,它也在文本区域中显示黑色边框。

要禁用边框,请尝试添加outline:none!important;,示例代码如下:

<style>
    textarea.style1,
    textarea.style1:focus,
    textarea.style1:hover {
        background-color: aqua;
        border-style: none;
        border-width: 0px;
        border-radius: 0px;
        resize: none;
        outline: none !important;
    } 
</style>

Edge浏览器(版本83.0.478.56(官方版本)(64位))中的输出如下所示: