HTML Introduction to HTML and CSS Make It Beautiful With CSS Adding a Style to several Elements using Class

what is the anchor tag again?

what is the anchor tag in HTML and how do i add a class to it?

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

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

  </body>
</html>
styles.css

2 Answers

Jason Howie
Jason Howie
Full Stack JavaScript Techdegree Graduate 20,769 Points

The anchor tag looks like <a>. Its an inline tag usually used for links. You can add a class to any opening tag by typing class="class-name" in between the brackets.

ok so I need to replace the <a> with adding the "social-links"? idk how to type what they are looking for in this test?

<a class="social-links">Follow me on Twitter!</a> <a class="social-links">Send me an Email!</a> THANKS FIGURED IT OUT

Hi Linsey.

Anchor tags are the elements that you create to link to other pages or parts of pages. The base tag is <a>, but you often see them with a couple of attributes as well:

<a href="http://www.google.com" title="Google!">Here's my link.</a>

Here's some more information on anchor tags: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a

You can add a class to an element by simply adding that attribute (class="") to the anchor tag and putting your class name in between the quotes of the attribute (giving your attribute a value) in the same way you'd add a URL in the href="" attribute.

Some additional information on classes: https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/class

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

THANKS I FIGURED IT OUT