An HTML element is all that makes up a defined HTML tag starting from its opening tag to its closing tag in a web page. An HTML element comprises the opening tag, the content (if any), attributes (if any) and finally the closing tag (if any).
Most of the time, an HTML tag is usually confuse with an HTML element but the difference is a tag is one of the predefined tags in HTML markup while an element is what is created with a tag or the result of a tag in an HTML document like images, paragraphs, headers, tables, videos and etcetera.
<p> <!-- paragraph tag -->
<div> <!-- division tag -->
<img> <!-- image tag -->
<h1> <!-- header1 tag -->
<h1>Hello World</h1> <!-- A header1 element -->
<img src='noon.jpg' height='60px' width='60px'/> <!-- An image element -->
<div><p>Welcome to my website where I share some tips on learning.</p></div> <!-- A division element with a paragraph element inside of it-->
In a nutshell, a tag such as the <img> enables us to create an image element.
Basically, HTML elements are the building blocks of a webpage. This is because, all that exist in a webpage are one or more elements created with tags to define the structure and contents.
- HTML elements are the basic building blocks of a website as websites are made up of different elements like links, buttons, text, images and etcetera.
- The life of an HTML element in a webpage starts with the declaration of an HTML tag to create such element. This means elements are created with HTML tags e.g the <img> tag used in creating image elements.
- Elements are most of the time confused for same thing as tags. It is therefore imperative to understand the difference.