HTML/CSS form background color - variables | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

HTML/CSS form background color - variables

Does anybody know why background-color: var(—my-chosen-color) doesn’t work? same question when trying to set width on Media Query with an variable length (px,em,vw)

10th Aug 2019, 1:15 PM
Yotko Kanchev
Yotko Kanchev - avatar
2 Answers
+ 1
1. CSS variable must be prefixed -- (two minus sign) 2. You need to define them first :root{ --my-chosen-color: black; } 3. If above doesn't help. Please show your code here so that we can help you https://www.sololearn.com/post/75089/?ref=app
10th Aug 2019, 3:39 PM
Gordon
Gordon - avatar
0
Yes i did defined them and prefixed them wih - -, i whanted to set the border color like this : table, tr, th, td { border-color: var(—default-color); i tryed to set MQ like this : @media (min-width: var(dafult-tablet-width)); both vars were set corectly as they works fine in background and color properties
10th Aug 2019, 3:53 PM
Yotko Kanchev
Yotko Kanchev - avatar