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 trialJoshua szkodlarski
8,604 PointsIm stuck on this question "Add an ID attribute with the value main to the div element." i tried everything
nothing is working
<!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>
<h1><em>Hello</em> World!</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 */
4 Answers
Joshua Veazey
6,190 PointsHi, are you giving the new "main" div selector any properties to define it's look?
Samuel Webb
25,370 PointsYour div element in your HTML should look like this:
<div id="main">
Samuel Webb
25,370 PointsBasically, the question is asking you to go to your HTML file, find the div element, and use the id tag to give it an id of "main"
Joshua szkodlarski
8,604 PointsI tried that and copied yours and still didn't work
Samuel Webb
25,370 PointsAll I can think of is that you're changing something else that you shouldn't be changing. Please post the code you use when you get your error. The examples above only show the code as it stands before you've done anything to it.
Jason Vogelsberg
3,344 PointsFormat you html like Samuel said above. Then, in your CSS, try adding:
"#main { do something; }"
Samuel Webb
25,370 PointsIn the CSS when selecting an ID, you need the hash(#) symbol before it as well. But this question is specifically geared towards setting the ID on the div in the HTML so adding that to the CSS shouldn't change the outcome.
Stanislav Beneš
13,465 Points<div id="main-content">
Andrea Faciane
10,042 PointsAndrea Faciane
10,042 PointsI hope this helps...
<div id="main"></div>