I'm trying to use css varible in my Angular application, inside a child component, and it's just not working. In the browser's Elements tool (I'm using Chrome latest version) the var() doesn't do anything. expamle:
css file:
:root {
--width: 43.75%;
}
#content {
display: grid;
grid-template-columns: repeat(2, var(--width));
grid-auto-rows: 90%;
grid-gap: 3px;
align-content: center;
justify-content: center;
border: 2px solid black;
width: 400px;
height: 250px;
margin: 0 auto;
}
And thats how it's shown in the browser:
Is CSS Variables can work with Angulat at all? Thank you
Your root selector probably gets also attribute with angular component id.
Try this
::ng-deep :root {
--width: 43.75%;
}