An HTML element is defined by a start tag, some content, and an end tag.
HTML Elements
The HTML element is everything from the start tag to the end tag:
<tagname>Content goes here...</tagname>
HTML Tag vs. Element
An HTML element is defined by a starting tag. If the element contains other content, it ends with a closing tag.
For example,
<p> is starting tag of a paragraph and </p> is closing tag of the same paragraph but <p>This is paragraph</p> is a paragraph element.
In general, HTML elements can be divided into two categories : block level and inline elements.
HTML Block Level Element
- HTML block level elements can appear in the body of an HTML page.
- It can contain another block level as well as inline elements.
- By default, block-level elements begin on new lines.
- block level elements create larger structures (than inline elements).
<div>, <p>, <li>, <main>, <nav>, <ul>, <form>, <video>, <table>, <aside>, <article> are some block lavel elements.
HTML inline elements
- HTML inline level elements can appear in the body of an HTML page.
- It can contain data and other inline elements.
- By default, inline elements do not begin on new lines.
- inline elements create shorter structures (than block level elements).
<span>, <a>, <code>, <strong>, <img>, <cite>, <button>, <input>, <textarea>, <select>, <small> are some of the inline tags.