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

What is a HTML Attribute?

I'm referring to this in general in HTML.

2 Answers

An HTML attribute is extra information that can be assigned to an element. This lets help developers when customizing html elements. languages like CSS and Javascript take advantage of attributes.

Hi,

I hope this helps. If I am incorrect, or you have a clearer way to explain it, please let me know.

According to the MDN (Mozilla Developer Network) "Elements in HTML have attributes; these are additional values that configure the elements or adjust their behavior in various ways to meet the criteria the users want."

So, basically, the HTML has elements, such as, <head>, <body>, <a>, <img>, etc..., the attributes are what define those elements in order to make the website interesting.

For example, the <a> element is an anchor element, but its attribute is the "href" which actually states what the element links to. So the HTML would state: <a href = "www.link.com"></a>

I hope that helps! Take care, Kaleena

Hey Kaleena,

When you are posting HTML on the site, be sure to either wrap it with 3 backticks as shown in the Markdown Cheatsheet/in the image below. You can also use HTML entities to display a < and >. Just use "& lt;" for < (put & and lt; together) and the same goes for > which is "& gt;" no spaces. If you don't do either of these methods, your elements will not display on the forums.

code