What is HTML and Why is it needed?

 HTML basically stands for Hyper Text Markup Language. It is a markup language that is used for describing web pages or web documents.

In simple words to understand the dependency of HTML on web pages,

No HTML       --->     No Web pages and websites.

 

Important information:

  • HTML is the collection of many different tags and each tag has its own functionality.

  • HTML code is executed on browsers, not at OS level.

  • HTML is also used for linking one page to another page on the website.

 

Let's see as an example, below

HTML Syntax:

<!DOCTYPE html>
<html>
<head> <title>Title of Webpage</title>
</head>
<body> <h1>This is My First Webpage</h1>
<p>My First paragraph.</p>
</body>
</html>

 

Output

This is My First Webpage

My First paragraph.

 

The above syntax is explained here:

DOCTYPE

Declaration explains what version of HTML tags are used. This makes the browser job easy in understanding the tags.

 

<html> and </html>

Anything specified with in this tag is a web page.

These are starting and ending tag of an HTML document.

 

<head> and </head>

A generic placeholder for HTML document header information.

It is an optional one.

Most of the information within these tags are not visible to naked eye.

 

<title> and </title>

Gives the title tag of HTML web page.

It is best practice to place it within <head> tags.

 

<body> and </body>

Information to be visible on web page is provided here.

 

<h1> and </h1>

Tags used for highlighting the header information in web page content.

There are multiple heading tags are in HTML. We have discussed them here.

 

<p> and </p>

Information to be displayed as paragraph section for ease of decoration.

 

HTML DOCTYPE

 The very first thing that needs to be inserted in an HTML document, even before the <html> tag, is the <!DOCTYPE> declaration.  

This declaration instructs the web browser regarding the version of the HTML, in which the page is written.

 

The <!DOCTYPE> declaration in the HTML version 4.01 refers to a DTD, as that version was based on SGML. DTD is used to specify the rules for the markup language, which enables the browsers to provide the constant correctly.

 

HTML5 does not require a reference to a DTD, as it is not based on SGML. So, one should always add the <!DOCTYPE> declaration to your HTML documents, which will let the browser know about the type of document to expect.

<!DOCTYPE html>
<html>
<head>
<title>Title of the document</title>
</head>
<body>
The content of the document......
</body>
</html>

 

Output

The content of the document......