CSS 从 textarea 中删除所有样式(边框、发光)
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/17109702/
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
Remove all stylings (border, glow) from textarea
提问by holyredbeard
I want to remove the stylings from a textarea and leave it all white without any border or glow, if possible. I've tried with different stuff found here on SO, but nothing works (tried with FF and Chrome).
如果可能,我想从 textarea 中删除样式,并使其全白,没有任何边框或发光。我试过在 SO 上找到不同的东西,但没有任何效果(用 FF 和 Chrome 试过)。
So, is it possible and if so how to do it?
那么,是否有可能,如果有,该怎么做?
What I've tried so far:
到目前为止我尝试过的:
textarea#story {
// other stuff
-moz-appearance:none;
outline:0px none transparent;
}
textarea:focus, input:focus{
outline: 0;
}
*:focus {
outline: 0;
}
回答by IamShipon1988
The glow effect is most-likely controlled by box-shadow. In addition to adding what Pavel said, you can add the box-shadow property for the different browser engines.
发光效果最有可能由 box-shadow 控制。除了添加 Pavel 所说的之外,您还可以为不同的浏览器引擎添加 box-shadow 属性。
textarea {
border: none;
overflow: auto;
outline: none;
-webkit-box-shadow: none;
-moz-box-shadow: none;
box-shadow: none;
resize: none; /*remove the resize handle on the bottom right*/
}
You may also try adding !important to prioritize this CSS.
你也可以尝试添加 !important 来优先考虑这个 CSS。
回答by Lucas B
If you want to remove EVERYTHING :
如果你想删除一切:
textarea {
border: none;
background-color: transparent;
resize: none;
outline: none;
}
回答by Pavel
try this:
尝试这个:
textarea {
border-style: none;
border-color: Transparent;
overflow: auto;
outline: none;
}
jsbin: http://jsbin.com/orozon/2/
jsbin:http://jsbin.com/orozon/2/
回答by Mahmoud
if no luck with above try to it a class or even id something like textarea.foo and then your style. or try to !important
如果上面没有运气,请尝试使用类或什至 id 之类的 textarea.foo 然后你的风格。或尝试 !important