本文介绍了在输入字段上还原Webkit的CSS大纲的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想恢复某些表单字段上的默认CSS outline 设置,但我希望将其恢复为默认的Webkit或浏览器特定样式。

I want to restore the default CSS outline setting on some form fields but I want it restored to the default Webkit or browser specific style.

我使用的页面在所有元素上都应用了 outline:none ,我只想恢复为几个默认设置那些。任何想法?

The page I'm working with has outline: none applied on all elements, and I just want to revert to the default setting on a few ones. Any ideas?

推荐答案

不使用outline:none重置,而是使用outline-width:

Instead of resetting with outline: none, reset with outline-width: 0. This prevents the browser from clearing the styles and when you reapply a width the style will still be there.

input:focus {
  outline-width: 0;
}

input.nostyle:focus {
  outline-width: 5px;
}

这篇关于在输入字段上还原Webkit的CSS大纲的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-11 09:32