[英]overwrite ng-bootstrap datepicker select.style
I'm using ng-bootstrap datepicker and having issue in select style month and year我正在使用 ng-bootstrap datepicker 并且在 select 风格的月份和年份中遇到问题
the problem is in select style.问题出在 select 样式中。
select[_ngcontent-c21] {
-ms-flex: 1 1 auto;
flex: 1 1 auto;
padding: 0 .5rem; // the problem in this line
In Html, I have like this:在 Html 中,我有这样的:
I think to solve this problem is to make padding 0.0rem我认为解决这个问题的方法是让padding 0.0rem
but I can not overwrite this style.但我不能覆盖这种风格。
You can overwrite every bootstrap style just by adding.important after value of style that u want to overwrite.您可以通过在您想要覆盖的样式值之后添加 .important 来覆盖每个引导程序样式。
Example bootstrap styles overwriting:示例引导 styles 覆盖:
.signup-form .btn:hover, .signup-form .btn:focus {
background: #179b81 !important;
}
In your case try:在你的情况下尝试:
select[_ngcontent-c21] {
-ms-flex: 1 1 auto;
flex: 1 1 auto;
padding: 0 rem !important;
}
add encapsulation: ViewEncapsulation.None,
in your component(where you are using the datepicker) metadata.添加encapsulation: ViewEncapsulation.None,
在您的组件(您使用日期选择器的地方)元数据中。
@Component({
selector: 'wrapper-date-picker',
templateUrl: './date-picker.component.html',
styleUrls: ['./date-picker.component.scss'],
encapsulation: ViewEncapsulation.None,
})
this is not just for datepicker, this helps you to overwrite any component from any 3rd party lib styles similar to ng-bootstrap.这不仅适用于 datepicker,它还可以帮助您覆盖来自任何 3rd 方库 styles 的任何组件,类似于 ng-bootstrap。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.