简体   繁体   English

CSS适用于特定类别

[英]CSS apply to specific class

I have an issues with bootstrap css overlap with custom css. 我在bootstrap CSS和自定义CSS重叠方面遇到了问题。 This is my app html that render date-picker and it's using bootstrap css. 这是我的呈现日期选择器的应用程序html,它使用的是Bootstrap CSS。

 <input type="text" class="datepicker-input" uib-datepicker-popup="{{format}}" ng-model="dt" is-open="status.opened" min-date="minDate" max-date="maxDate" datepicker-options="dateOptions" date-disabled="disabled(date, mode)" ng-required="true" close-text="Close" ng-click="open($event)" placeholder="Choose your date"/>

This is my custom made .btn class that cause an issue with bootstrap btn class. 这是我的自定义.btn类,导致引导btn类出现问题。 I can't remove this class or modify the name directly as many other pages using this btn style. 我无法像使用此btn样式的其他许多页面一样直接删除此类或直接修改名称。

.btn {
    background-color: #b0b1a8;
    border-radius: 4px;
    border-width: 0;
    color: #fff;
    display: inline-block;
    font-weight: bold;
    font-size: 21px;
    font-size: 2.1rem;
    padding: 8px 20px;
    padding: 0.8rem 2rem;
    margin: 0;
    outline: none;
    text-align: center;
    -webkit-transition: background-color 100ms cubic-bezier(0.25, 0.1, 0.25, 1), border-color 100ms cubic-bezier(0.25, 0.1, 0.25, 1);
    -moz-transition: background-color 100ms cubic-bezier(0.25, 0.1, 0.25, 1), border-color 100ms cubic-bezier(0.25, 0.1, 0.25, 1);
    transition: background-color 100ms cubic-bezier(0.25, 0.1, 0.25, 1), border-color 100ms cubic-bezier(0.25, 0.1, 0.25, 1);
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    white-space: nowrap
}

Now, how can I trick the above css so not to implement it's .btn to my date picker button. 现在,我该如何欺骗上面的CSS,以免对我的日期选择器按钮实施.btn Thanks 谢谢

您应该尝试更改自定义CSS类名称(.btn)

So, what it sounds like is you want your date picker to look a certain way but the .btn css from bootstrap is doing what it wants? 因此,听起来像是要让日期选择器看起来有某种方式,但是引导程序中的.btn css在做什么呢? If you are able to add a class to that button then you may just have to override it using !important . 如果您能够向该按钮添加一个类,则可能只需要使用!important覆盖它即可。

For example: 例如:

.bootstrap-btn{background: pink; font-size: 20px; border: 3px solid white;}

.my-new-btn{background: white !important; font-size: 24px !important; border: 2px solid green !important;}

Again, this would be if you can add the my-new-btn class to your button. 同样,这就是您可以将my-new-btn类添加到按钮中的情况。 I have had to use this method quite a few times when I cannot edit classes loaded via scripts or something. 当我无法编辑通过脚本或其他方式加载的类时,我不得不使用这种方法多次。

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

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