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 triallayeesolo
7,316 PointsWhy is my code not working? I am trying to get the image to display once.
Can someone please explain to me what am I doing wrong?
<!DOCTYPE html>
<html>
<head>
<title>Background Properties</title>
<link rel="stylesheet" href="page.css">
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="box"></div>
</body>
</html>
/* Complete the challenge by writing CSS below */
.box{background:#387abc;
background-image:url("../img/mike.png")no-repeat;
}
2 Answers
mikes02
Courses Plus Student 16,968 PointsFirst, make sure the path to your image is correct. Then, you can actually simplify what you are trying to accomplish like so:
.box{
background: #387abc url("../img/mike.png") no-repeat;
}
The long form would be
.box{
background-color: #387abc;
background-image: url("../img/mike.png");
background-repeat: no-repeat;
}
layeesolo
7,316 Pointsthanks. I got it now