What does the default value mean in the value of the css property?

The twitter bootstrap has many CSS properties with !default at the end.

eg.

 p { color: white !default; } 

What does !default do?

UPDATE

I feel bad that I do not understand. I am using the SASS port of Bootstrap.

+42
css sass twitter-bootstrap
May 17 '12 at 20:35
source share
2 answers

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

Also, I could not find links to !default in the LESS documentation , and as far as I know, this is exclusive to Sass. Are you sure you found this in the Bootstrap source and not elsewhere? Because I honestly don’t remember how Sass / SCSS code in Bootstrap stylesheets.

For what it costs, the only valid token starting with ! in CSS !important , which you may already know about .

+29
May 17 '12 at 20:42
source share

! default is often used in Bootstrap Sass. It seems like the opposite! Important. All Bootstraps variables are set using! Default to allow the developer to further customize the download. FROM! By default, sass will only define a variable if it is not already set.

This provides more flexibility.

 //Example1 Dress color = red $auroras-dress-color: blue; $auroras-dress-color: red; //Example2 Dress color = red $auroras-dress-color: blue !default; $auroras-dress-color: red; //Example3 Dress color = blue $auroras-dress-color: blue; $auroras-dress-color: red !default; 

So why is this important? Bootstrap is a package. Most people do not edit the Bootstrap source. NEVER UPDATE SOURCE OF BOTSTRAP. To configure the download, you will add your own variable file and compile it using the boot code, but never touch your own download package. The Bootstrap sass page makes full sense of how to set up and compile it in documents.

I do not know why it does not do less. I have not worked with less and do not know if it has its own variable management mechanism.

Fiddle example https://jsfiddle.net/siggysid/344dnnwz/

+16
Mar 07 '17 at 21:47
source share



All Articles