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="">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="">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.


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