简体   繁体   English

如何覆盖引导样式

[英]How to override a Bootstrap style

How can I do to override an existing class of Bootstrap 我该怎么做才能覆盖现有的Bootstrap类

The btn and active class names are added automatically from Bootstrap. btnactive类名称是从Bootstrap自动添加的。 I want a specific color on the inset. 我想要特定颜色的插图。

        <div class="categories">
            <label class="ng-binding">Categories</label>
            <div class="btn-group" data-toggle="buttons">
                  <label class="btn active">
                    <input type="radio" name="cat" id="rbOption1"> Cat 1
                  </label>
                  <label class="btn">
                    <input type="radio" name="cat" id="rbOption2"> Cat 2
                  </label>
            </div>
        </div>

I've been trying to do this with no positive result 我一直在尝试这样做没有任何积极结果

.categories label#active {
    box-shadow: inset 0 3px 5px blue !important";
}

As per my understanding of the question, this is what you have to do in order to override the Bootstrap style. 根据我对问题的理解,这是您必须做的,才能覆盖Bootstrap样式。

.categories .btn.active {
   box-shadow:inset 0 3px 5px blue;
 }

If you want to use the same style through out your application or page, 如果您想在整个应用程序或页面中使用相同的样式,

.btn.active {
   box-shadow:inset 0 3px 5px blue;
}

You can place an id on the label. 您可以在标签上放置一个ID。

HTML HTML

<label id="active" class="btn">

CSS CSS

#active {
 box-shadow: inset 0px 0px 10px #FF0000;
}

codepen codepen

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM