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 trialHanna Han
4,105 PointsHTML elements vs. HTML tags
Hi, I wonder what is different between HTML elements and HTML tags as terms?
2 Answers
trio-group I.AM
25,713 PointsHey!
Designers and developers use these terms interchangeably and you will hear them very often. The only difference between the two is that 'HTML element' mostly refers to a building block of a page (could be anything, e.g. columns, sections, buttons, links, etc.) and 'HTML tag' can refer to all those things but also to "empty" elements like the <br> tag for example. Such tags are not necessarily building blocks but they do have their purpose and function on a web page.
It would be great to hear the opinions of other developers on this one. Maybe others don't see any differences between the two terms and use them as total synonyms.
Emil Pesaxov
3,684 PointsHello,
At the begining, this question occured to me as well. So it is a perfectly normal and natural question to arise for every starting web developer. The difference between HTML tags and HTML elements is as follows:
Take for example the following code: <p>Hello World</p> The opening p is a tag as well as the closing p. They are refered to as opening tag and closing tag, respectively.
An element is the combination of the opening tag, closing tag and any content that is between the two.
As trio interactive mentioned before, there are empty elements as well. Which is a term given to tags that have no closing tag, such as <br>, <hr>, <link>, <input>, <img> etc.