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
stephenallison
8,559 PointsHow do you add a class to the paragraph element?
I'm not sure how to add class "main-pg" to the paragraph element? Is this done in html or the css page?
3 Answers
Erik Nuber
20,629 Points<p class="classNameHere" id="idNameHere> Your Text </p>
this will allow you to style them in css
.classNameHere {
yourstyles
}
#idNameHere {
your styles
}
Julian Gutierrez
19,325 PointsAdd it to the existing paragraph. the syntax is as follows:
<p class="put your class name here">My amazing website</p>
stephenallison
8,559 PointsThank you for the response!
Yuan Gao
8,947 PointsHi Stephen, you can assign the value of the property ("main-pg" in your case) to the property ("class" in your case) by using this format:
<p property = "property value"> </p>
stephenallison
8,559 PointsThank you for the response!
stephenallison
8,559 Pointsstephenallison
8,559 Points<!doctype html> <html> <head> <link href="styles.css" rel="stylesheet"> </head> <body> <p>My amazing website</p>
</body> </html>
Thanks so much for the response! Im still not sure where it goes in the code. Do i create a new paragraph or add it to the existing one?