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 trialPaul Blanchard
5,652 PointsI am unable to get past this question I have tried many different code applications none work.
It is CSS Foundations challenge task 2 of 6
<!DOCTYPE html>
<html>
<head>
<title>CSS Selectors</title>
<link rel="stylesheet" href="cc1-main-styles.css" type="text/css" media="screen">
<link rel="stylesheet" href="style.css" type="text/css" media="screen">
</head>
<body>
<body class="main-body">
<h1><em>Hello</em> World!</h1>
<h1 class="main-h1>
<div>
<p>
<em>Lorem ipsum dolor</em> sit amet, consectetur adipiscing elit. Nunc pulvinar consequat tortor, nec venenatis erat elementum scelerisque. Curabitur sit amet risus nisi. Aenean aliquet euismod augue at viverra. Ut varius arcu in lorem iaculis ullamcorper. Integer eu rutrum quam.
</p>
</div>
</body>
</html>
/* Complete the challenge by writing CSS below */
.main-body {
background:lightblue;
}
.main-h1 {
color:darkblue
}
3 Answers
Paul Blanchard
5,652 PointsThank you TJ! It is best to just keep it simple by following the questions carefully.
TJ Egan
14,420 Pointstry writing it like this -
body {
background-color:lightblue;
}
h1 {
color: darkblue;
}
Css is very picky on syntax, and won't work unless it is perfect. Here you were missing a semicolon.
Also, if you are targeting the h1 of the div with a class of .main, you need to separate the two. The way you had it written was telling the computer to apply the darkblue color to a class called 'main-h1'.
Shawn Gregory
Courses Plus Student 40,672 PointsTJ
I wasn't even using the .main and it passed. I guess it could have gone either way. That's the funny thing about CSS.
/* Complete the challenge by writing CSS below */
body {
background-color: lightblue;
}
h1 {
color: darkblue;
}
Cheers!
TJ Egan
14,420 PointsYeah I hadn't loaded up the challenge and was just looking at the code provided. What you've got is the correct way to do it based on the challenge, edited mine to show that!