禁用或重置 CSS 规则

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/4396848/
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-29 23:17:30  来源:igfitidea点击:

Disable or reset a CSS rule

css

提问by AlenDel

If define a CSS rule with top: 0;, how can I later disable or neutralise it in favor of bottom: 0;used elsewhere?

如果使用 定义 CSS 规则top: 0;,我以后如何禁用或中和它以支持在bottom: 0;其他地方使用?

回答by tenfour

do top: auto; bottom:0;- autois the default value for top

do top: auto; bottom:0;-auto是默认值top

回答by Jan

top: auto;
bottom: 0px;

回答by Leo

if you have the stretch issue just use initialto reset the rule

如果您有拉伸问题,只需使用初始值来重置规则

top: initial;

or

或者

bottom: initial;

回答by Ilium

CSS is cascading, so for example, if you put p { top: 0;)first and p.bottom {top:auto; bottom: 0;)after that, your css will listen to the latter for p.bottom

CSS 是级联的,因此例如,如果您p { top: 0;)先放p.bottom {top:auto; bottom: 0;)后放,您的 css 将监听 p.bottom 的后者