我怎样才能"undo" outline:none;不删除规则?
How can I "undo" outline:none; without deleting the rule?
我正在使用一个 WordPress 主题,该主题已将 outline:none;
应用于多个元素的 :focus
状态。我需要在不修改父主题文件的情况下否定它,但似乎没有任何效果。
这是我尝试过的方法:
*:focus { outline: inherit !important; }
*:focus { outline: initial !important; }
a, a:focus { outline: inherit !important; }
a, a:focus { outline: initial !important; }
我真的很想将其重置为默认值,但到目前为止唯一有结果的是:
*:focus { border: 3px solid red !important; }
但我真的不想手动设置样式,让浏览器自己做吧。
我同意@soulshined 关于使用 class 的评论,但您要查找的值是 auto
.
代码段(在开发人员工具中手动将其聚焦)
a:focus {
outline: 0;
}
#withOutline:focus {
outline: auto;
}
<a href="javascript:void(0)">A bunch of text</a>
<a href="javascript:void(0)">A bunch of text</a>
<a href="javascript:void(0)">A bunch of text</a>
<a href="javascript:void(0)">A bunch of text</a>
<a id="withOutline" href="javascript:void(0)">A bunch of text</a>
我正在使用一个 WordPress 主题,该主题已将 outline:none;
应用于多个元素的 :focus
状态。我需要在不修改父主题文件的情况下否定它,但似乎没有任何效果。
这是我尝试过的方法:
*:focus { outline: inherit !important; }
*:focus { outline: initial !important; }
a, a:focus { outline: inherit !important; }
a, a:focus { outline: initial !important; }
我真的很想将其重置为默认值,但到目前为止唯一有结果的是:
*:focus { border: 3px solid red !important; }
但我真的不想手动设置样式,让浏览器自己做吧。
我同意@soulshined 关于使用 class 的评论,但您要查找的值是 auto
.
代码段(在开发人员工具中手动将其聚焦)
a:focus {
outline: 0;
}
#withOutline:focus {
outline: auto;
}
<a href="javascript:void(0)">A bunch of text</a>
<a href="javascript:void(0)">A bunch of text</a>
<a href="javascript:void(0)">A bunch of text</a>
<a href="javascript:void(0)">A bunch of text</a>
<a id="withOutline" href="javascript:void(0)">A bunch of text</a>