Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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

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

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


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
221,292 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.


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