Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

CSS

Michael Andreuzza
Michael Andreuzza
11,000 Points

img-path

why do we need a variable for img path....isn't it sort of more work?

1 Answer

Sam Gord
Sam Gord
14,084 Points

if you change the location of the image and if u used that address in for example 5 places, all u need to do in order to put everything in the correct place is to just change the address in that one address variable u defined and it will work perfectly, but if u type the address u have to change/correct the address 5 times ( or more ! ).

but, tbh, i haven't seen using css variables for holding image addresses, but i did see the benefits of storing color hex codes in css variables ;)

Michael Andreuzza
Michael Andreuzza
11,000 Points

Well, with that point of view is fair-play. I agree, its much easier with variables for color,absolutely.

thank you for your answer.

/Mike