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

HTML Introduction to HTML and CSS (2016) Make It Beautiful With CSS Test: Styling by Element and Class

Alisa Anderson
Alisa Anderson
4,277 Points

adding a card title to css

How do I add a card title to my css sheet for a border?

index.html
<!doctype html>
<html>
  <head>
    <link href="styles.css" rel="stylesheet">
  </head>
  <body>

    <p class="main-pg" .cardtitle> My amazing website</p>

  </body>
</html>
styles.css
.main-pg {
  text-align:center
}

<p>
.card-title {
border: solid 4px red;
}
</p>

1 Answer

Cristian La Spina
Cristian La Spina
11,829 Points

In your HTML you should add the class 'cardtitle' inside the class attribute without dot, like this:

<p class="main-pg cardtitle"> My amazing website</p>

In your CSS you should remove that <p> opening and closing tag which is not a correct syntax. Also don't forget to complete every value property with a semi-colon (you're missing one after 'center') ... you're also using the name 'card-title' in your CSS while is 'cardtitle' in your html, they should be the same:

.main-pg {
  text-align: center;
}

.cardtitle {
border: solid 4px red;
}