我正在使用Angular 6.0.8
版本Angular Material theme
6.4.0
每当我尝试稍微修改材质主题时,它永远不会起作用,因为我总是找到材质主题属性来覆盖我的 CSS 属性,如下所示:
currentColor .mat-input-element (material theme)
initial input, textarea, select, button (user agent stylesheet)
#1072BA .English
#1072BA .English
#1072BA body
仅应用第一个属性(其余属性被删除)
我尝试了多种变体来解决这个问题,但都没有奏效(比如使用重要或更改导入主题的顺序)
那么在材料主题和用户样式表中更改小东西的正确方法是什么?(例如应用此英语规则)
我的styles.scss如下,它只适用于覆盖Material 主题的颜色和字体不起作用:
@import '~@angular/material/prebuilt-themes/indigo-pink.css';
/* You can add global styles to this file, and also import other style files */
/* prevent clicking in the wizard nav header */
.mat-horizontal-stepper-header{
pointer-events: none !important;
}
@font-face {
font-family: 'Material Icons';
font-style: normal;
font-weight: 400;
src: url(./assets/material_icons/material_icons.woff2) format('woff2');
}
.material-icons {
font-family: 'Material Icons';
font-weight: normal;
font-style: normal;
font-size: 24px;
line-height: 1;
letter-spacing: normal;
text-transform: none;
display: inline-block;
white-space: nowrap;
word-wrap: normal;
direction: ltr;
-webkit-font-feature-settings: 'liga';
font-feature-settings: 'liga';
-webkit-font-smoothing: antialiased;
}
.mat-radio-button{
margin: 10px;
}
.mat-checkbox{
margin-bottom: 10px;
}
.Done-numbers{
color: red;
font-weight: bold;
}
.finInfo-hint{
color: gray;
}
.finInfo-success{
color: green;
}
.Arabic {
font-family: "AXtManal" !important;
margin: 0;
/* background: #fff; */
font: normal 16px/20px Verdana;
color: #1072BA;
text-shadow: 0 0 0 #1072BA;
}
.English {
font-family: "Rotis" !important;
margin: 0;
/* background: #fff; */
font: normal 16px/20px Verdana;
color: #1072BA;
text-shadow: 0 0 0 #0078be;
}
更新1:
请查看这个 stackblitz 示例,其中的问题非常清楚
1-我期望带有阿拉伯语类的封闭 div应更改包含的材料表单字段的字体和颜色,但它不会(如 Sushi 的第一个字段,字体未更改)
这非常重要,因为所有元素都包含在带有 ngClass 的 div 中,其中包含英语或阿拉伯语,并且我想将该类应用于所有包含的元素,包括材料表单字段
2- 如何将所有表单标签的颜色从蓝色更改为红色或绿色?