CSS 重置/删除所有浏览器(包括移动设备)中输入、选择和按钮的所有样式

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/33476762/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-30 11:33:11  来源:igfitidea点击:

Reset/remove all styles for input, select and button across all browsers including mobile

cssselectbuttoninput

提问by MrJamesBond

I've searched all over for this but I can only find how to change/modify styles for input, select and button elements.

我已经到处搜索了,但我只能找到如何更改/修改输入、选择和按钮元素的样式。

What I want to do is remove all shadows, borders, background, icons etc everything except the value itself, across all browsers and mobile.

我想要做的是在所有浏览器和移动设备上删除除值本身之外的所有阴影、边框、背景、图标等所有内容。

回答by Fazil Abdulkhadar

You can use normalize.cssfor improve the cross-browser rendering. You can update the following class in the normalize.css.

您可以使用normalize.css来改进跨浏览器渲染。您可以更新 normalize.css 中的以下类。

button,
input,
optgroup,
select,
textarea,html input[type="button"],
input[type="reset"],
input[type="submit"],button[disabled],
html input[disabled],button::-moz-focus-inner,
input::-moz-focus-inner, input[type="checkbox"],
input[type="radio"], input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button, input[type="search"], input[type="search"]::-webkit-search-cancel-button,
input[type="search"]::-webkit-search-decoration

Please add the following style to the above elements.

请将以下样式添加到上述元素中。

element {
    border:none;
    background-image:none;
    background-color:transparent;
    -webkit-box-shadow: none;
    -moz-box-shadow: none;
    box-shadow: none;
}

回答by Tom

Style the input tag via css.

通过 css 设置输入标签的样式。

See: http://www.w3schools.com/tags/tag_input.asp

见:http: //www.w3schools.com/tags/tag_input.asp

input etc.:

输入等:

input, select, textarea {

}

Buttons:

纽扣:

input[type="submit"] {

}

Reset the css: http://cssreset.com/

重置 csshttp: //cssreset.com/

Nice looking reset: https://necolas.github.io/normalize.css/

漂亮的重置:https: //necolas.github.io/normalize.css/