HTML Introduction to HTML and CSS 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
172,182 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>