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

WordPress

How do I set an image background via css inside style.css file?

I have an image that'd like to show as a background via css rule inside the style.css file. At the moment, the code is as such: "background-image: url('../images/mobile_hands_pills.png') no-repeat center center;". Why is it that the image isn't showing? Thanks, Alex

2 Answers

Kevin Korte
Kevin Korte
28,149 Points

It's almost certainly because the image URL isn't right. Give me some example code and what files are in play here?

Hi Kevin,

Thanks for getting back to me, and I apologies for the belated replay.

You are right! The URL was totally wrong, and so now it's working ;).