Skip to content

override :host css in ionic framework

how can i override :host 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;


PS. this css is on ion-content

I’d appreciate any help.



You don’t have to change the :host CSS to change the background of ion-content. You can add this to your CSS

    --ion-background-color:#111D12; // Or whatever color you want

But if you really want to change :host CSS, then you can add this in your global CSS file.

:host {
    --background: none; // or whatever color you want
User contributions licensed under: CC BY-SA
6 People found this is helpful