What is HTML file extension?


HTML (Hyper Text Markup Language) is the extension for web pages created to open in the browser. It is used to format the structure of a webpage. It contains tags that defined the page layout and content of the webpage. HTML files are used online and displayed in web browsers.

HTML pages are either got from the server where these are hosted or they are loaded from local system as well. Each HTML page is made up of HTML elements like forms, texts, images, links, etc. These elements are represented by tags and several others where each tag has start and end. It can be used to embed Javascript and CSS.

History

HTML was introduced in 1991 as a way for web browsers to interpret and display webpages. HTML has gone through multiple revisions that include HTML 2 (1995), HTML 3 (January 1997), HTML 4 (December 1997), and HTML 5 (2014).

HTML file format structure

HTML consists of three parts –

  • A line containing HTML version information
  • A declarative header section
  • A body, contains the document’s actual content.

HTML elements are used for building the structure of webpages. Each element includes an opening tag enclosed with an angle bracket and a closing tag in angle brackets but with a forward slash preceding the tag.

The basic elements include –

  • <head> - used to contain metadata about a webpage
  • <body> - defines the body of a webpage
  • <h1> - text header tag used to create text title in a webpage
  • <p> - defines a paragraph in a webpage
  • <img> - used to embed an image in a webpage
  • <ul> - unordered list to create a bulleted list in a webpage
  • <div> - divider tag used to create a section in a webpage

Version Information

The first line of code, , is called a doctype declaration and tells the browser which version of HTML the page is written in. There are several different doctype declarations that names the document type definition in use for the document.

HTML 4.01 Strict –

HTML 4.01 Transitional –

HTML 4.01 Frameset –

For HTML 5, the version information is simple as show below –

<!DOCTYPE html>
                

Header Information

The header of an HTML document includes a number of HTML elements that are not rendered by the browser. Such elements describe about the page or include sections that are used to retrieve information from external resources like CSS stylesheets or Javascript files.

Body Information

This is the main section having all content of the file. HTML body can contain markups that refer to multiple blocks in the shape of tags. It has various information like images, texts, color, graphics, etc. Also, audio and video elements are embedded in html body. In the presence of modern

HTML elements

Elements in HTML document are indicated by tags, in angle brackets. The extent of an element is indicated by “start tag” <p> and “end tag” </p> The content of the element, if any, is placed between these tags.

The start tag includes attributes within the tag. These indicate other information like identifiers for sections within the document. Identifiers are also used to bind style information to the presentation of the document and for some tags such as <img> used to embed images.

Some elements like line break <br> or <br/> do not allow any embedded content, text or further tags. These need a single empty tag and do not use an end tag.

It is not necessary to have attributes in every tag and if attributes are not mentioned, default values are used in each case.

Elements examples –

Header

<head>
  <title>The Title</title>
</head>

Headings

<h1>Heading level 1</h1>
<h2>Heading level 2</h2>
<h3>Heading level 3</h3>
<h4>Heading level 4</h4>
<h5>Heading level 5</h5>
<h6>Heading level 6</h6>

Paragraphs

<p>Paragraph 1</p>
<p>Paragraph 2</p>