on-internet
← Community

Custom CSS property "background-color" not working

Stack Overflow ·

I've been trying to use CSS variables recently in a very simple code. It actually did not work. I double checked the information I found about how to use variables but I can't find my mistake. Maybe I am doing something wrong? :root { --my-color: red; } body { background-color: var(--my-color); } <!DOCTYPE html> <html> <head> <title>My title</title> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" type="text/css" href="./style/mainPage.css"> <!-- Latest compiled and minified CSS --> <link rel="stylesheet" href="https://maxcdn.bo

Comments

Sign in or sign up to comment and upvote.

No comments yet.