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

General Discussion

Is it an img TAG or an img ELEMENT?

I'm stumped.

I'm referring to this:

<img src="" alt="" width="" height="" border="0" />

Would you call this an img TAG or an img ELEMENT?

3 Answers

"element" refers to the whole thing. "Tag" refers to what's inside your angle brackets <>. So in this case, where there's no content to the element besides the tag, unfortunately the terms are interchangeable.

Here's a better explanation. Here is an element:

<p class="whatever">Here is a paragraph.</p>

Here is an opening tag:

<p>

Here is an opening tag with an attribute:

<p class="whatever">

EDIT: http://www.456bereastreet.com/archive/200508/html_tags_vs_elements_vs_attributes/

Awesome. Thanks so much for your help Gary. So, to recap, if the tag is self closing then it is also an element?

Correct. And you could refer to an element with no content as an "empty element".

The technical term for that is a "void element"

source: HTML5 spec