Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

CSS Variables not work with custom property fallback values

I am declaring a custom property in :root like below, but my color not work for me. What I am wrong?

:root {
    --color-primary: var(--color-primary, #ffc107);
}
body {
    background-color: var(--color-primary); // background color not work
}

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

Declaring css variables should be like this:

:root {
    --color-primary: #ffc107;
}
body {
    background-color: var(--color-primary);
}
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading