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

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
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
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

Austin Whipple
Austin Whipple
29,725 Points

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