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 How to Make a Website Creating HTML Content Structure the Image Gallery

Raymond Franks
Raymond Franks
180 Points

What is an HTML attribute?

What is an HTML attribute, and how is it written within the HTML structure?

2 Answers

Mark Shiel
Mark Shiel
12,225 Points

An attribute is additional information specified within a tag. It is presented in the format attribute="value".

Example: <tag attribute="value">tag content</tag>

A working example would be the <a> tag used to form a link, the tag itself encloses the content which will become a link but it is the attribute "href" which is used to specify where the link points to.

Example: <a href="link.html">link</a>

Jason Anders
Jason Anders
Treehouse Moderator 145,860 Points

MOD edit -> added markdown (3 back ticks) before and after code so it will be visible in your answer.