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

How do I get a class attribute with the intro into the <p> element.

I have a problem so that I put for an example .intro{ <p title="title"> , so is it possible to fix this?

3 Answers

Logan R
Logan R
22,989 Points

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

To add a class, you go to your element, <p>, and just like IDs, you add class= (Instead of id=) and insert your class name.

<p class="intro">

"Select the class intro and set its font weight to bold."

To select the class via CSS, you add a period before it.

.intro {
font-weight: bold;
}

I tested it to make sure all the code works, and it does :)

Markus Ylisiurunen
Markus Ylisiurunen
15,034 Points

Hi Christopher!

You might have to explain a little bit more your problem but I'll try to help you.

If I understood your question right, your problem is to set a class name to <p> tag.

You can do it like this:

<p class="intro"> Some text here... </p>

and you can target it in css like this:

p.intro {
    /* Your code here */
}

/* Or just only eith the class */

.intro {
    /* Your code here */
}

Thanks for my help.