覆盖:离子框架中的主机CSS

Muk*_*sti 4 javascript ionic-framework angular

我怎样才能覆盖:主机CSS

:host {
--width: 304px;
--min-width: auto;
--max-width: auto;
--height: 100%;
--min-height: auto;
--max-height: auto;
--background: var(--ion-background-color, #fff); // <-- i want to shut this down
inset: 0px;
display: none;
position: absolute;
contain: strict;
Run Code Online (Sandbox Code Playgroud)

}

附言。这个CSS是关于离子内容的

我将不胜感激任何帮助。

小智 6

您不必更改:hostCSS 即可更改ion-content. 您可以将其添加到您的 CSS 中

ion-content{
    --ion-background-color:#111D12; // Or whatever color you want
}
Run Code Online (Sandbox Code Playgroud)

但如果您确实想更改:hostCSS,则可以将其添加到全局 CSS 文件中。

:host {
    --background: none; // or whatever color you want
}
Run Code Online (Sandbox Code Playgroud)