Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to properly override a box-shadow bootstrap mixin?

This is the code:

<ul>
    <li></li>
    <li></li>
    <ul>
        <li></li>
        <li></li>
    </ul>
</ul>

And this is the LESS style:

ul li { .box-shadow(0 1px 3px rgba(0,0,0,.25)); }

I want to override/cancel the mixin on the sub-list, so I tried this:

ul ul li { .box-shadow(none); }

...but it didn't work. The only way I got it to work was by explicitly overriding each line on the mixin:

ul ul li { 
          -webkit-box-shadow: none;
             -moz-box-shadow: none;
                  box-shadow: none;
         }

So wha'ts wrong with ul ul li { .box-shadow(none); }?

like image 612
Wallace Sidhrée Avatar asked Nov 08 '12 13:11

Wallace Sidhrée


People also ask

How do I remove a button shadow in Bootstrap?

Use the . shadow-none class in Bootstrap to remove shadow.

How do I add a shadow to a container in Bootstrap?

While shadows on components are disabled by default in Bootstrap and can be enabled via $enable-shadows , you can also quickly add or remove a shadow with our box-shadow utility classes. Includes support for . shadow-none and three default sizes (which have associated variables to match).

Which of the following Bootstrap class name will add a shadow to an HTML element?

You can add shadow to the element by adding . shadow class within the <div> element.


2 Answers

Too bad I didn't check the bad output when it broke the whole compilation, but

ul ul li { .box-shadow(none); }

...is working just fine. :P

like image 93
Wallace Sidhrée Avatar answered Sep 18 '22 15:09

Wallace Sidhrée


If you use twitter bootstrap with SCSS/SASS, I would use the builtin mixins, which handels browser specific flags:

ul ul li { @include box-shadow(none); }
like image 30
Fa11enAngel Avatar answered Sep 19 '22 15:09

Fa11enAngel