Skip to main content

Learn HTML: A Comprehensive Introduction to HTML

HTML Introduction

  • HTML stands for HyperText Markup Language. It is a standard markup language used for creating web pages and web applications.

  • HTML provides the structure and content of a web page.

  • HTML uses tags to define the structure and layout of a web page. Tags are enclosed in angle brackets (< >) and describe the content they enclose.

  • HTML tags can be used to create headings, paragraphs, lists, images, links, forms, tables, and other elements.

  • HTML documents must include a <html> tag that encloses the entire document.

  • HTML documents also require a <head> section that contains information about the document, such as the page title and links to external stylesheets and scripts.

  • The <body> section contains the content of the web page that will be displayed in the browser.

A Simple HTML Example

Editor

Loading...

Explanation

  • <!DOCTYPE html>: This is a declaration that tells the browser which version of HTML the document is written in. In this case, it is the latest version of HTML, which is HTML5.

  • <html>: This tag indicates the beginning of an HTML document and encloses all of the other elements in the document.

  • <head>: This section of the document contains metadata about the page, such as the page title and links to external stylesheets and scripts. This information is not displayed on the page itself.

  • <title>: This is the title of the page, which appears in the browser's title bar and is used by search engines to identify the page.

  • <body>: This section of the document contains the content of the web page that will be displayed in the browser.

  • <h1>: This is a level one heading, which is the largest and most important heading on the page.

  • <p>: This is a paragraph of text that will be displayed on the page.

HTML Element

HTML elements are defined using opening and closing tags that enclose the content of the element.

As an example:

The following code defines a paragraph element that contains some text.

<h1>My first heading.</h1>

In this example:

  • <h1> is the opening tag for the paragraph element, and </h1> is the closing tag.
  • The text "This is a paragraph." is the content of the element.

Examples:

Start tagElement contentEnd tag
<h1>My First Heading</h1>
<p>My first paragraph.</p>
<br>nonenone
Empty Elements

Some HTML elements have no content (like the <br> element). These elements are called empty elements. Empty elements do not have an end tag.