Why does my :root variable affect the entire background?

Because you created a global variable of pink and then used that variable to set your body background color. The body is the “entire background”.

https://www.w3schools.com/css/css3_variables.asp

1 Like