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

HTML How to Make a Website Customizing Colors and Fonts Use Color in CSS

I was wondering what I was doing wrong here is my code, header { background-image: url("img_webtexture.jpg");

my goal was to add a image to use as the background for my header in css

2 Answers

Have you checked the path to your image? the link you are reffering to at the moment is a link in the root map. if you placed your image in a folder named "images" be sure to add it to the path like this:

background-image: url("images/img_webtexture.jpg");

the actual image name is "web texture.jpg" and the folder its in is named "img" so how would that be set up

Well if you take a closer look at my code before it says:

background-image -> wich is the CSS you want to do. url -> this is where the link comes in between (" ").

Then it is followed by the map name / name of the image . extension.

I'll give you one more example but i'll leave it to you for your own css so you'll learn more.

if i have an image in the folder images, named profile-picture.jpg. the code will be:

header {
background-image: url("images/profile-picture.jpg")
}

note: if your css is in another folder, be sure to go back into the root folder by placing double dots in front of your url followed by a slash. like this:

header {
background-image: url("../images/profile-picture.jpg")
}

ok so I get what your saying and fixed it to but it still won't work do I have to add anything to the html my new css is header { background-image: url("img/web-texture.jpg"); and im clueless what is wrong

don't forget your closing bracket and check for any typo's

Also, is there any content yet in the header? otherwise the header will not show since you didn't declare a width and a hight to it. make sure to add those aswell

I have the closing bracket but I have a border-color element set to black but thats it

Define your width and hight and width, it should be working this way

so I may sound stupid asking this but how would I go about judging the hieght and width and what unites would I use