首页 > 解决方案 > 覆盖 ng-bootstrap datepicker select.style

问题描述

我正在使用 ng-bootstrap datepicker 并且在选择样式月份和年份时遇到问题

在此处输入图像描述

问题出在选择风格上。

select[_ngcontent-c21] {
    -ms-flex: 1 1 auto;
    flex: 1 1 auto;
    padding: 0 .5rem;    // the problem in this line

在 HTML 中,我有这样的:

在此处输入图像描述

我认为解决这个问题的方法是让padding 0.0rem

但我不能覆盖这种风格。

标签: cssangularng-bootstrap

解决方案


您只需在要覆盖的样式值之后添加 !important 即可覆盖每个引导程序样式。
示例引导样式覆盖:

.signup-form .btn:hover, .signup-form .btn:focus {
    background: #179b81 !important;
}

在你的情况下尝试:

select[_ngcontent-c21] {
    -ms-flex: 1 1 auto;
    flex: 1 1 auto;
    padding: 0 rem !important; 
}

推荐阅读