Overriding Material2 Style with Custom CSS

僤鯓⒐⒋嵵緔 提交于 2019-12-04 17:07:06

Another option is to set the View Encapsulation to None on your component:

@Component({
    templateUrl: './my.component.html' ,
    styleUrls: ['./my.component.scss'], //or .css, depending what you use
    encapsulation: ViewEncapsulation.None,
})

Then in your component css you can do exactly what you tried:

.mat-datepicker-toggle {
  margin-right: 10px !important;
}

You need to use ::ng-deep. In your component css, set your style to the following:

::ng-deep .mat-datepicker-toggle {
  margin-right: 10px !important;
}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!