Learn HTML ELEMENTS

#iwritecode

What is HTML Element

An HTML element is a component of an HTML document that tells a web browser how to structure and interpret a part of the HTML document.HTML elements can contain formatting instructions, semantic meaning, and content.

For example, HTML elements are used to denote document parts such as headers, paragraphs, and footers and to embed content such as hyperlinks, text, and images.

Below is an illustration that labels each of the parts of an HTML element:

Labeling

How To Use and Understand HTML Elements

Let’s try exploring HTML in practice.

Type of Element

For the default display and styling purpose in HTML, all the elements are divided into two categories:

  • Block-level element

  • Inline element

Block-level element:

These are the elements, which structure the main part of a web page, by dividing a page into coherent blocks.

A block-level element always starts with a new line and takes the full width of a web page, from left to right.

These elements can contain block-level as well as inline elements.

Following are the block-level elements in HTML.

<address>, <article>, <aside>, <blockquote>, <canvas>, <dd>, <div>, <dl>, <dt>, <fieldset>, <figcaption>, <figure>, <footer>, <form>, <h1>-<h6>, <header>, <hr>, <li>, <main>, <nav>, <noscript>, <ol>, <output>, <p>, <pre>, <section>, <table>, <tfoot>, <ul> and <video>

Example of Block Element

Inline elements:

Inline elements are those elements, which differentiate the part of a given text and provide it with a particular function.
These elements do not start with a new line and take width as per requirement.
The Inline elements are mostly used with other elements.

Following are the inline-level elements in HTML.

<a>, <abbr>, <acronym>, <b>, <bdo>, <big>, <br>, <button>, <cite>, <code>, <dfn>, <em>, <i>, <img>, <input>, <kbd>, <label>, <map>, <object>, <q>, <samp>, <script>, <select>, <small>, <span>, <strong>, <sub>, <sup>, <textarea>, <time>, <tt>, <var>.

Example of Inline Element

Following is the list of some main elements used in HTML:

Start tagContentEnd tagDescription
<h1> to <h6>These are headings of HTML</h1>..</h6>These elements are used to provide the headings of the page.
<p>This is the paragraph</p>This element is used to display content in form of a paragraph
<div>This is a div section</div>This element is used to provide a section on a web page.
<br>This element is used to provide a line break.
<hr>This element is used to provide a horizontal line.

Resources

Javapoint W3school