css属性值中的default是什么意思? [英] What does !default in a css property value mean?

查看:454
本文介绍了css属性值中的default是什么意思?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

twitter启动代码有很多CSS属性,最后有一个!default

The twitter bootstrap code has a lot of CSS properties with a !default at the end.

p {
  color: white !default;
}

> do?

What does !default do?

UPDATE

我使用的Bootstrap的SASS端口。

My bad for not being clear. I am using the SASS port of Bootstrap.

推荐答案

Twitter Bootstrap使用LESS就我所见。另一方面, !默认实际上是Sass的一部分,并且用于给出Sass变量( $ var )默认值,这将使它在给定上下文中无效,即使在

Twitter Bootstrap uses LESS as far as I've seen. On the other hand, !default is actually part of Sass, and is used for giving Sass variables ($var) default values, which would make it invalid in your given context, even in Sass.

此外,我还未找到任何对!的引用 LESS文档,据我所知,它是Sass独有的。你确定你在Bootstrap的源代码而不是其他地方找到了这个?因为我真的不记得在Bootstrap的样式表中看到Sass / SCSS代码。

Besides, I've not been able to find any references to !default in the LESS documentation, and to my knowledge it is exclusive to Sass. Are you sure you found this in Bootstrap's source and not elsewhere? Because I honestly don't remember seeing Sass/SCSS code in Bootstrap's stylesheets.

对于值得的,只有以开头的有效令牌! 在CSS中是!important 您可能已经知道

For what it's worth, the only valid token that starts with ! in CSS is !important, which you may already be aware of.

这篇关于css属性值中的default是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆