TutorialLab
difference between html element and tag image
Home » Web Development » HTML Tutorials » Difference between HTML Tags and Elements

Difference between HTML Tags and Elements

When I was in university during graduation, one of our book was about HTML and the subject for that was a beginner to web development (Some sort of name) here is the best book I recommend for web development beginner, so learning HTML which was pretty easy to learn and implement compared to modern languages.

Suddenly few questions were arises during the reading or during the class and I asked teacher sometimes, but when I was practicing at home at that time also few questions arise in mind, for example: What is the Difference between HTML tags and elements?

So, I start searching the answer to this question and the answer I received by asking a question on StackOverflow or few other web development related forum. and you know this blog post is also about the question which arises in my mind a few years back: Difference between HTML tags and elements.

First I will tell you about HTML Tags and Then elements afterword I will show you the difference between both.

HTML Tags

HTML Tags are the starting and ending markup of HTML object. OR HTML Tags are the keywords surrounded by the angle brackets “< >”, HTML Tags normally comes in pairs like “<p>” and “</p>”, but few tags are also stand alone like <br>, Also, HTML Tags are not visible on the browser the to web surfer or at the front end of the website.

There is three type of tags, Start tag or opening Tag, end tag or closing tag and tag with attributes.

Start Tag is a tag which only contain angle brackets eg:

End Tag is tag which contain angle brackets and forward slash eg:

Tag with attributes is opening tag with an extra attribute like css class name or width or height etc. eg:

 

HTML Elements

An element in HTML represents some kind of structure or semantics and generally consists of a start tag, content, and an end tag. Below is a paragraph element.

 

HTML Elements are each and every part of HTML document, like body text, header, footer etc.

 

Difference between HTML Tags and Elements

So, here is the difference, Tags are the parts of an element which an element itself contain HTML tags. Like in below image you will see an element with contents and tags. so that is the only difference. Elements contain tags and attribute and an element is surrounded by tags, opening tag, and closing tag and between that is the contents.

difference-between-HTML-tags-and-elements Image

hassan

A Freelancer web developer, graphic designer and own this blog to spread knowledge.My hobby is computer problem's solving and i love to help other in this field.

HTML Tutorials