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 trialMUZ140259 Juliana Kofi
9,532 Pointsposition
Position the background image to be vertically and horizontally centered.
<!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-color:#387ABC;
background-image:url('img/mike.png');
background-repeat:no-repeat;
background-position:;
}
2 Answers
Chris Grazioli
31,225 PointsCheck out the reference material and learn how to help yourself better: https://developer.mozilla.org/en-US/docs/Web/CSS/background-position or http://www.w3schools.com/cssref/pr_background-position.asp
Just using background-position: center; should suffice, but center center; will work Try doing it with responsive percentages background-position: 50% 50%;
Gavin Ralston
28,770 Points.box {
background-position: center center;
}
first value is for horizontal center, second is for vertical :)
Gavin Ralston
28,770 PointsGavin Ralston
28,770 PointsSo much for trying the no-nonsense reply! Thought I had a good feeling for the kind of rapport they wanted. :)
I repeat to myself, "Teach them to fish...."