Css variables - using the var () function with rgba and percentages and deg

hello,

please see

how do i code var(–color-light-blue)

and var (–color-dark-blue)

here

background: linear-gradient(45deg, rgba(153,176,233,1) 35%, rgba(0,151,255,1) 72%);

the percentages and and 45deg are throwing me off:(

not sure how to write the proper code…

proper syntax

how should these be written to work?

also, please,

if i want my css vaiables site wide, do i code the :root and all css variables in a external style sheet then link every page of my project to that style sheet?

see what i mean??

thanks!!!

Use:
background: linear-gradient(45deg, var(--color-light-blue) 35%, var(--color-dark-blue) 72%);

You do not need to use an external style sheet. You could declare the variables for each web page.

1 Like