Essential HTML Tags - GeeksforGeeks (2024)

Last Updated : 20 Aug, 2021

Comments

Improve

HTML stands for HyperText Markup Language. It is an important language to design web pages or websites. These websites are visible to anyone on the internet. HTML is a combination of Hypertext and Markup language. Where hypertext is a link between the webpages, and markup language is used to define the text document within a tag, that defines the structure of the web pages.

HTML uses predefined tags that tell the browser how to display the content. Tags are nothing but some instructions that are enclosed in angle braces(i.e., <>). It is divided into three parts, i.e., opening tag, content(which will display on the browser), and closing tag, but some tags are special tags that do not contain closing tags like <BR> tag. When you are working with HTML tags always remember to include closing tags. If you forget to close the tag, the browser applies the effect of the opening tag until the end of the page. HTML contains four essential tags that form the basic structure of any webpage or HTML file:

  1. <html></html>
  2. <head></head>
  3. <title></title>
  4. <body></body>

Now let us discuss each tag one by one:

1. <!DOCTYPE html>

It is also known as document type and should be included in an HTML file. It actually tells the browser that this is an HTML document. It is not a tag or an element but it is information.

Syntax:

<!DOCTYPE html>

2. <html></html>

This tag marks the beginning and ending of the HTML document and whatever code is present in between these tags totally gets considered by the browser. Also, it tells the browser that the document is an HTML document. All the other tags in between these tags only get considered by the browser.

Syntax:

<html> Content </html>

3. <head></head>

This tag store the data which actually doesn’t appear on the webpage but it gives more information about the webpage. Or in other words, this tag is used to define the head part of the document which contains the information related to the webpage. It also contain tags like, <title>, <meta>, <link>, <style>, etc.

Syntax:

<head> <title> Title of the Webpage </title></head>

4. <title> </title>

This tag stores the title/name of the web page. Whatever title/content is given in this tag, the content appears on the tab when opened by the browser. It is described in the head tag.

Syntax:

<title> Title of the Webpage </title>

5. <body></body>

This tag is used to display all the information or data, i.e, text, images, hyperlinks videos, etc., on the webpage to the user. Here, all the content like text, images, hyperlinks videos, etc., are enclosed between this tag.

Syntax:

<body> Content </body>

Some other HTML tags are:

1. <!– comment –>

This tag is used to add comments in the HTML codes. These comments help the program to understand the code. The content inside the comment tag doesn’t visible on the browser.

Syntax:

<!–Write comments here –>

2. <meta>

These meta tags are used inside the head tag and they making describe the metadata i.e data about data. These tags are useful in search engine optimization which means when users search for our websites the chances that the browser recommends our webpage becomes high which leads to an increase in traffic over the webpage. A single HTML document can contain multiple tags.

Syntax:

<meta attribute-name=”value”>

3. <link rel =”stylesheet” href=”file.css “>

This tag is used to include external style sheets. Use this tag when you don’t want to include CSS in the HTML document. To make it more simple we make a CSS file with the code and include this file in the link tag.

Syntax:

<link rel =”stylesheet” href=”file.css “>

4. <script></script>

It is used for including javascript code. The external javascript can also be linked using the src attribute in the opening script tag. It can be included in the head or body tag.

Syntax:

<script>script content</script>

5. Heading:

HTML provides six types of headings, i.e., H1, H2, H3, H4, H5, and H6. Here, H1 is the highest level heading and H6 is the lower level heading. These headings are used to highlight the important topics.

Syntax:

<h1> content </h1>

<h2> content </h2>

<h3> content </h3>

<h4> content </h4>

<h5> content </h5>

<h6> content </h6>

Example 1:

Simple HTML program:

HTML

<!DOCTYPE html>

<html lang="en">

<head>

<!--The description written on title tag get appeared as browser tab name-->

<title>Geeks For Geeks </title>

</head>

<!-- Whatever content in body tag appears on the webpage-->

<body>

<h1> Geeks For Geeks </h1>

<h3> A computer science portal for geeks </h3>

</body>

</html>

Output:

Essential HTML Tags - GeeksforGeeks (1)

Example 2:

HTML program in which we are adding external CSS using the <link> tag

HTML

<!DOCTYPE html>

<html lang="en">

<head>

<!--Meta data-->

<meta charset="UTF-8">

<meta http-equiv="X-UA-Compatible" content="IE=edge">

<meta name="viewport" content="width=device-width, initial-scale=1.0">

<!--Including css file with name GFG.css-->

<link rel="stylesheet" href="GFG.css">

<!--The description written on title tag get appeared as browser tab name-->

<title>Geeks For Geeks </title>

</head>

<!-- Whatever content in body tag appears on the webpage-->

<body>

<h1> Geeks For Geeks </h1>

<h3> A computer science portal for geeks </h3>

</body>

</html>

GFG.cssbody { text-align: center;}h1{ color: darkgreen;}h3{ color:darkgreen;}:

Output:

Essential HTML Tags - GeeksforGeeks (2)

Example 3:

HTML program in which we are adding javascript file GFG.JS using <script> tag:

HTML

<!DOCTYPE html>

<html lang="en">

<head>

<!--Meta data-->

<meta charset="UTF-8">

<meta http-equiv="X-UA-Compatible" content="IE=edge">

<meta name="viewport" content="width=device-width, initial-scale=1.0">

<!--Including css file with name GFG.css-->

<link rel="stylesheet" href="GFG.css">

<!--The description written on title tag get appeared as browser tab name-->

<title>Geeks For Geeks </title>

</head>

<!-- Whatever content in body tag appears on the webpage-->

<body>

<!--Including JS file with name GFG.JS-->

<script src ="GFG.JS"> </script>

<h1> Geeks For Geeks </h1>

<h3> A computer science portal for geeks </h3>

<button onclick="darkMode()"> CLICK ME TO GET DARK MODE</button>

</body>

</html>

Javascript

function darkMode() {

document.body.style.backgroundColor = "black";

}

Output:

Essential HTML Tags - GeeksforGeeks (3)

Essential HTML Tags - GeeksforGeeks (4)

On clicking the button.



L

lokeshpotta20

Improve

Next Article

HTML Deprecated Tags

Please Login to comment...

Essential HTML Tags - GeeksforGeeks (2024)

FAQs

Essential HTML Tags - GeeksforGeeks? ›

Essential tags for defining the HTML document structure are <!DOCTYPE html>, <html>, <head>, and <body>.

What are the 25 basic HTML tags? ›

All HTML Tags with Examples
  • <p> Paragraph Tag </p> The <p> and </p> represent HTML tags, and the term “Paragraph Tag” signifies the HTML element, specifically the text displayed on the page. ...
  • <h2> Heading Tag </h2> ...
  • <b> Bold Tag </b> ...
  • <i> Italic Tag </i> ...
  • <u> Underline Tag </u>

What are the 142 tags in HTML? ›

HTML Tags Ordered Alphabetically
TagDescription
<textarea>Defines a multiline input control (text area)
<tfoot>Groups the footer content in a table
<th>Defines a header cell in a table
<thead>Groups the header content in a table
118 more rows

What are the 10 basic HTML tags in detail? ›

Commonly used tags in HTML
HTML TagSyntaxDescription
<div><div>...</div>Defines a division or section in an HTML document.
<p><p>...</p>Defines a paragraph.
<a><a href="...">...</a>Defines a hyperlink.
<img><img src="..." alt="...">Embeds an image.
14 more rows
Jul 1, 2024

What are the 3 required HTML tags? ›

There are four required tags in HTML. These are html, title, head and body. The table below shows you the opening and closing tag, a description and an example. These are the tags you put at the beginning and end of an HTML file.

What are the necessary element tags in HTML? ›

Basic Elements
  • A text header, denoted using the <h1>, <h2>, <h3>, <h4>, <h5>, <h6> tags.
  • A paragraph, denoted using the <p> tag.
  • A horizontal ruler, denoted using the <hr> tag.
  • A link, denoted using the <a> (anchor) tag.
  • A list, denoted using the <ul> (unordered list), <ol> (ordered list) and <li> (list element) tags.

What are the 30 basic HTML tags? ›

30 HTML Tags to know
  • <! DOCTYPE>
  • <html>
  • <head></head>
  • <title>
  • <body>
  • <h1></h1> <h2></h2> <h3></h3> <h4></h4> <h5></h5> <h6></h6>
  • <p></p>
  • <br>
Jan 31, 2022

What are the 5 most repeated HTML tags in a web page? ›

Popular Tags in HTML
  • The paragraph tag <p> Save. <p> is a container element used to introduce a paragraph. ...
  • The bold text tag <b> Save. ...
  • The italic text tag <i> Save. ...
  • The heading tags <h1> to <h6> Save. ...
  • The link tag <a> Save. ...
  • The item tag <li> Save. ...
  • The ordered list tag <ol> Save. ...
  • The unordered list tag <ul> Save.

What are the 15 empty tag in HTML? ›

List of empty tags in HTML
  • <area>
  • <base>
  • <br>
  • <col>
  • <embed>
  • <hr>
  • <img>
  • <input>
Sep 14, 2020

How many HTML tags exist? ›

Of the 142 HTML tags that exist, all of them serve their purpose across different levels within the HTML document, some of them become full elements and some become empty elements. Full elements have permitted content while empty elements don't have any permitted content.

What are the essential parts that every HTML document should contain? ›

An HTML 4 document is composed of three parts: a line containing HTML version information, a declarative header section (delimited by the HEAD element), a body, which contains the document's actual content.

What are the 4 essential tags in HTML? ›

Basic HTML
TagDescription
<html>Defines an HTML document
<head>Contains metadata/information for the document
<title>Defines a title for the document
<body>Defines the document's body
6 more rows

What are the 4 basic HTML structural tags? ›

These tags are <html> , <head> , <title> and <body> . The <html> tags must begin and end the document and the <head> tags must appear before the <body> tags. Also, the <title> tags must be within the <head> tags.

What are 5 formatting tags in HTML? ›

Formatting elements were designed to display special types of text:
  1. <b> - Bold text.
  2. <strong> - Important text.
  3. <i> - Italic text.
  4. <em> - Emphasized text.
  5. <mark> - Marked text.
  6. <small> - Smaller text.
  7. <del> - Deleted text.
  8. <ins> - Inserted text.

What are the main tags in HTML? ›

Basic HTML
TagDescription
<!DOCTYPE>Defines the document type
<html>Defines an HTML document
<head>Contains metadata/information for the document
<title>Defines a title for the document
6 more rows

What are the frequently used HTML tags? ›

Popular Tags in HTML
  • The paragraph tag <p> Save. <p> is a container element used to introduce a paragraph. ...
  • The bold text tag <b> Save. ...
  • The italic text tag <i> Save. ...
  • The heading tags <h1> to <h6> Save. ...
  • The link tag <a> Save. ...
  • The item tag <li> Save. ...
  • The ordered list tag <ol> Save. ...
  • The unordered list tag <ul> Save.

Which tags are essential parts of a web page? ›

Let's now examine each of these tags:
  • The first line is the DOCTYPE. ...
  • <html> is typed before all the text in the document. ...
  • <head> Web pages are divided into two main sections: the head and the body. ...
  • <title> You must give your document a title. ...
  • <meta> is a tag that has many purposes, depending on what attribute it has.

Top Articles
Meet the Richest Forex Traders of All Time & in the World Today
Trading EURUSD Like a Pro
Thedirtyship
Old Bahama Bay Quad Folding Wagon
Wowhead Filling The Cages
Poochies Liquor Store
Everything We Know About Wenwen Han and Her Rise To Stardom
Accident On May River Road Today
Cratebrowser
Ge Tracker Awakener Orb
Six Broadway Wiki
Martimelons
Calculator Souo
Do you want to do a backbend?
Huniepop Jessie Questions And Answers
NEU: LEAKSHIELD - das sicherste Flüssigkeits-Kühlsystem der Welt - Wasserkühlung
Minnesota Gophers Highlights
Breakroom Bw
Craigslist Ct Pets
San Antonio Craigslist Free
American Flat Track Season Resumes At Orange County Fair Speedway - FloRacing
Swissport Timecard
Hannah Palmer Listal
Dumb Money, la recensione: Paul Dano e quel film biografico sul caso GameStop
Live Stream Portal
David Goggins Is A Fraud
Pcc Skilled Nursing Login
Stuckey Furniture
Itsfunnydude11 Wisconsin Volleyball Team : Itsfunnydude11 Twitter, Itsfunnydude11 Reddit – Know About It ! - Opensquares
Conan Exiles Meteor Shower Command
Dutchessravenna N Word
Rare Rides: The 1970 Chevrolet Chevelle SS454 LS6 Convertible - Street Muscle Rare Rides
Unblocked Games 66E
Help with Finding Parts for Your Vehicle
Did Taylor Swift Date Greg Gutfeld
Glassbox Eyecare
Craigslist Lake Charles
Tények este teljes adás, 2024. április 26., péntek
Barbarian Frenzy Build with the Horde of the Ninety Savages set (Patch 2.7.7 / Season 32)
Matt Laubhan Salary
10439 Gliding Eagle Way Land O Lakes Fl 34638
P1 Offshore Schedule
Cetaphil Samples For Providers
Uncg Directions
Pirates Bay Knaben
Craigslist Ri Rhode Island
Before Trump, neo-Nazis pushed false claims about Haitians as part of hate campaign
Craigslist Farm And Garden Atlanta Georgia
What Does Wmt Contactless Mean
Craigslist Cars By Owner
Liberty 1098-T
Larry's Country Diner LIVE! - 2024 Tickets - Branson Travel Office
Latest Posts
Article information

Author: Lakeisha Bayer VM

Last Updated:

Views: 5596

Rating: 4.9 / 5 (69 voted)

Reviews: 84% of readers found this page helpful

Author information

Name: Lakeisha Bayer VM

Birthday: 1997-10-17

Address: Suite 835 34136 Adrian Mountains, Floydton, UT 81036

Phone: +3571527672278

Job: Manufacturing Agent

Hobby: Skimboarding, Photography, Roller skating, Knife making, Paintball, Embroidery, Gunsmithing

Introduction: My name is Lakeisha Bayer VM, I am a brainy, kind, enchanting, healthy, lovely, clean, witty person who loves writing and wants to share my knowledge and understanding with you.