What is HTML?

Zeyan Rhys
Written by
Zeyan Rhys
Python Educator
Subarna Basnet
Verified by
Subarna Basnet
Technical Editor
What is HTML?
May 4, 2025
4 min read

Table of Contents

HTML, or HyperText Markup Language, is the fundamental language of the web. It’s the skeleton of any webpage, providing structure and layout by using a system of tags. HTML doesn’t include logic or interactive capabilities by itself – that’s where languages like JavaScript or CSS come in. But without HTML, there would be no web pages to style or script.

The Basics of HTML

HTML documents are made up of elements. Each element has an opening tag, content, and a closing tag. The most basic structure of an HTML document includes a combination of these elements to create a webpage that a browser can render.

An HTML element consists of:

  • An opening tag (e.g., <p>),
  • Content (e.g., "This is a paragraph."),
  • A closing tag (e.g., </p>).

Example:


<p>This is a simple HTML paragraph.</p>

In this example:

  • <p> is the opening tag,
  • </p> is the closing tag,
  • And anything between the tags is the content.

The Structure of an HTML Document

Every HTML document has a basic structure. Here's an example of how it looks:


<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <title>Sample Page</title>
    </head>
    <body>
        <h1>Welcome to HTML</h1>
        <p>This is a paragraph of text on a webpage.</p>
    </body>
</html>

This structure breaks down as:

  • <!DOCTYPE html>: Declares the document type and version of HTML being used (HTML5).
  • <html lang="en">: The root element that wraps all other content. The lang="en" attribute specifies that the content is in English.
  • <head>: Contains meta information like the character encoding (<meta charset="UTF-8">) and the title that appears in the browser tab (<title>).
  • <body>: This is where the content that will be displayed on the webpage is placed. In this case, it includes an <h1> heading and a <p> paragraph.

Common HTML Elements

HTML includes a variety of elements used to create the structure of a webpage. Some of the most commonly used tags include:

  • Headings (<h1>, <h2>, etc.): Define headings of different levels. <h1> is the most important, and <h6> is the least.

<h1>Main Heading</h1>
<h2>Subheading</h2>

  • Paragraph (<p>): Defines a block of text, typically used for regular content.

<p>This is a paragraph of text.</p>

  • Links (<a>): Used to create hyperlinks to other pages or websites. The href attribute specifies the destination URL.

<a href="https://www.example.com">Visit Example</a>

  • Images (<img>): Embeds images into a webpage. The src attribute specifies the image's source location, and the alt attribute provides a description of the image for accessibility.

<img src="image.jpg" alt="A scenic view">

  • Lists (<ul>, <ol>, <li>): Define unordered (bulleted) or ordered (numbered) lists.

<ul>
    <li>Item 1</li>
    <li>Item 2</li>
</ul>

  • Forms (<form>): Used for collecting user input, such as text fields, checkboxes, or radio buttons.

<form action="/submit">
    <input type="text" name="name">
    <input type="submit" value="Submit">
</form>

HTML Attributes

HTML elements can have attributes that provide additional information. Attributes are always placed inside the opening tag and are usually in name-value pairs.

  • href: Specifies the URL for links.
  • src: Defines the source of an image.
  • alt: Provides a text description of an image.
  • id: Assigns a unique identifier to an element.
  • class: Groups elements for applying shared styles.

For example, the image tag below includes both src and alt attributes:


<img src="logo.png" alt="Website Logo">

Zeyan Rhys
Zeyan Rhys
Python Educator

Zeyan Rhys is a Python developer and content writer at Syntax Notes, where he turns complex coding concepts into simple, beginner-friendly tutorials. He’s passionate about helping others understand Python in a way that actually clicks.