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

CSS CSS Foundations Selectors Type, Class, and ID Selectors

stage 2 challenge 5

Add a class attribute with the value "intro" to the <p> element.

index.html
<!DOCTYPE html>
<html>
<head>
  <div id="main">
    <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>
     <p .intro=">
     <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>
style.css
/* Complete the challenge by writing CSS below */
body {
background-color:lightblue;
 }
h1{
color:darkblue;
}
p {
color:red;
}
.intro p{

}

2 Answers

I don't have direct access to this challenge, and I don't recall what the full question was. If the challenge asks for a <p> with a class of "intro", then the markup would be:

<p class="intro">

and the CSS would simply be:

.intro {
  /* rules */
}

If the challenge asks for a <div> with the class "intro", then you would have this markup:

<div class="intro">
  <p>
  </p>
</div>

and the CSS would be:

.intro p {

}

The .intro p is necessary in the second case because the p is a descendant of the div with the intro class.

Jeremy Faith
PLUS
Jeremy Faith
Courses Plus Student 56,696 Points

They are asking you to add a class attribute to the p tag. <p class="intro"> You use the dot(.) notation when you are selecting a class in your CSS.