Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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,060 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