如何设置背景颜色IONIC 4 [英] How to set background color IONIC 4
问题描述
我在尝试仅在一个 IONIC 4 (--type=angular) 页面中更改背景颜色时遇到问题.我正在尝试为离子含量添加一个类.在我的 html 文件中,我有:
I having problems trying to change the background color in just one IONIC 4 (--type=angular) page. I am trying to add a class for the ion-content. In my html file I Have:
<ion-content class="fondologin">
...
</ion-content>
在我的 sass 中:
In my sass I have:
.fondologin{
background-color: #111D12!important;
}
背景颜色永远不会改变.如果我添加 --ion-background-color:#111D12;在 variables.scss 中,每个页面的背景都已成功更改,但我只是在一个页面中更改颜色.我怎样才能做到这一点?
The background color is never changed. If I add --ion-background-color:#111D12; in variables.scss the background is successfully changed for every page but I just one to change the color in one page. How can I achieve this?
推荐答案
出于某种原因,我是这样解决的:
For some reason I solved it this way:
首先,我在主题文件夹内的 variables.scss
文件中添加了 --ion-background-color:#ffffff;
.
First of all I added --ion-background-color:#ffffff;
in the variables.scss
file inside theme folder.
在我的页面 scss 中我写道:
In my Page scss I wrote:
ion-content{
--ion-background-color:#111D12;
}
之后背景设置成功.
这篇关于如何设置背景颜色IONIC 4的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!