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 trialLinsey Buckner
3,073 Pointswhat is the anchor tag again?
what is the anchor tag in HTML and how do i add a class to it?
<!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>
2 Answers
Jason Howie
Full Stack JavaScript Techdegree Graduate 20,769 PointsThe 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.
Austin Whipple
29,725 PointsHi 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
Linsey Buckner
3,073 Points<a class="social-links">Follow me on Twitter!</a> <a class="social-links">Send me an Email!</a>
THANKS I FIGURED IT OUT
Linsey Buckner
3,073 PointsLinsey Buckner
3,073 Pointsok so I need to replace the <a> with adding the "social-links"? idk how to type what they are looking for in this test?
Linsey Buckner
3,073 PointsLinsey Buckner
3,073 Points<a class="social-links">Follow me on Twitter!</a> <a class="social-links">Send me an Email!</a> THANKS FIGURED IT OUT