简体   繁体   English

如何在默认的Angular-material css上优先考虑自定义css

[英]How to prioritize custom css over the default Angular-material css

By default, the search label is padded to left.. ie, padding-left: 3px is assigned by Angular-material.min.css 默认情况下,搜索标签填充到左边..即, padding-left: 3pxAngular-material.min.css分配

在此输入图像描述

When I pad it to right by customizing the same in my custom.less file, it's not taken high priority over the default css from Angular-material.min.css 当我通过在custom.less文件中自定义它来向右填充它时,它不会优先于Angular-material.min.css的默认css。

在此输入图像描述

Load your CSS in the proper order. 以正确的顺序加载CSS。

HTML HTML

<head>
  <link rel="stylesheet" type="text/css" href="Angular-material.min.css">
  <link rel="stylesheet" type="text/css" href="custom.css">
</head>

This is because the C in CSS stands for Cascading . 这是因为CSS中C代表Cascading This means that rules that are seen later on overwrite rules that were seen previously. 这意味着稍后会在覆盖之前看到的规则中看到规则。

尝试在您的css样式属性中添加!important

padding-left: 29px !important;

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

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