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 Adding a Style to several Elements using Class

I need to Add a class called "social-links" to each anchor tag but I don't know how

I've been looking at the video multiple times but cannot find how to do this

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

    <class href="social-links">Follow me on Twitter!</a>
    <class href="social-links">Send me an Email!</a>

  </body>
</html>
styles.css

2 Answers

You've got your closing anchor text tag </a> so first make sure it has an opening tag, too. Like this: <a>Your text</a>.

Next, to direct that anchor tag to a location you'll point to that location with the href= like this:

<a href="www.teamtreehouse.com">Your text</a>

Finally, to apply a class for styling use class="" within the opening anchor text tag, like this:

<a class="your-class" href="www.teamtreehouse.com">Your text</a>

Steven Parker
Steven Parker
229,670 Points

The first thing after that "<" symbol is the tag name. That determines what kind of tat it is. In this case, that needs to be "a" which is the tag name for anchor tags. Once a tag is created, that part usually will never be changed.

Then, between the name and the ">" symbol you can have attributes and values. The code already had the "href" attribute and a value for it. That should be left as it was. But you can add another attribute named "class" followed by an equal sign and then the value in quotes.

Example:

    <a href="#" class="social-links">Follow me on Twitter!</a>