[英]ionic5 set background color
I have created a few custom colors and would like to set the background of a ion-col
cell.我创建了一些自定义 colors 并想设置ion-col
单元格的背景。 But how?但是怎么做? My colors work for buttons for instance:例如,我的 colors 适用于按钮:
<ion-button color="custom-blue" ... >...</ion-col>
but但
<ion-col color="custom-blue" ... >...</ion-col>
fails.失败。 Same with background-color
.与background-color
相同。 Can I set ion-col
colors at all or to I have to paste a ion-item
into it?我可以完全设置ion-col
colors 还是必须将ion-item
粘贴到其中?
Use background-color
CSS property.使用background-color
CSS 属性。 color
attribute does not exist for ion-col
ion-col
不存在color
属性
However, you won't be able to access your custom color directly inside SCSS file.但是,您将无法直接在 SCSS 文件中访问您的自定义颜色。 Use this to apply background to all ion-col
:使用它为所有ion-col
应用背景:
ion-col{
background-color:var(--ion-color-custom-blue);
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.