Introduction to HTML

HTML Course
</>
Start Here

Introduction to HTML

Learn the foundation of every website — from basic structure to your first web page.

11 TopicsCode ExamplesBeginner Friendly

What is HTML?

HTML (HyperText Markup Language) is the standard markup language used to create and design web pages. It describes the structure of a web page using a series of elements, which tell the browser how to display the content.

The term HyperText refers to the ability to link various web pages together, while Markup Language indicates that it uses tags to mark elements within the text.

HTML was created by Tim Berners-Lee in 1991. The latest version is HTML5, which introduced many new features like semantic elements, audio/video support, canvas, and more.

💡
HTML is NOT a programming language — it is a markup language. It does not have logic, loops, or variables. It only defines the structure and content of a web page.

Key Facts about HTML

  • HTML stands for HyperText Markup Language
  • HTML describes the structure of a Web page
  • HTML consists of a series of elements
  • HTML elements tell the browser how to display the content
  • HTML file extension is .html or .htm
  • HTML can be created and edited using any text editor like Notepad, VS Code, Sublime Text, etc.

History of HTML & Versions

HTML has evolved significantly since its creation in 1991. Here is a brief timeline of official HTML versions:

HTML Version Timeline

1991
HTML 1.0— Tim Berners-Lee invented HTML. The first version had only 18 tags.
1995
HTML 2.0— Published as a standard by IETF. Added form elements and tables.
1997
HTML 3.2— W3C Recommendation. Added support for scripts, tables, applets.
1999
HTML 4.01— Major version with CSS support, scripting improvements, and accessibility features.
2000
XHTML 1.0— HTML reformulated as XML. Stricter syntax rules.
2008/14
HTML5— Current living standard. Added semantic elements, multimedia, Canvas, SVG, and Web Storage.

HTML Editors

HTML files can be created using any text editor. However, specialized code editors provide features like syntax highlighting, auto-completion, and error detection.

VS CodeRecommended

Most popular free code editor by Microsoft. IntelliSense, extensions, integrated terminal, and Git support.

NotepadWindows

Simple text editor built into Windows. Great for beginners to understand raw HTML.

Sublime TextFast

Lightweight and fast editor with powerful shortcuts and a distraction-free writing mode.

Notepad++Free

Free source code editor for Windows. Supports syntax highlighting for many languages.

✅
For beginners, we recommend using VS Code (Visual Studio Code) — it is free, lightweight, and has excellent HTML support built-in.

Basic Structure of an HTML Page

Every HTML page follows a standard structure. Here is the basic skeleton of an HTML document:

index.html
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>My First Web Page</title>
</head>
<body>
    <h1>Hello World!</h1>
    <p>This is my first web page.</p>
</body>
</html>
Try in Live HTML CompilerRun & preview this code instantly in your browser without installing anything!

Explanation of Each Part

<!DOCTYPE html>Declares that this document is an HTML5 document. Must be the very first line.
<html>The root element. All other elements are contained inside this.
<head>Contains meta-information about the page (title, charset, stylesheets). NOT displayed on screen.
<meta charset="UTF-8">Character encoding (UTF-8 supports most global characters and symbols).
<meta name="viewport">Makes the web page responsive on mobile devices.
<title>Sets the title shown in the browser tab.
<body>Contains all the visible content (text, images, links, tables, forms, etc.).
<h1>Defines the main heading of the page.
<p>Defines a paragraph of text.

HTML Tags & Syntax

HTML uses tags to define elements. Tags are written inside angle brackets < >. Most tags come in pairs — an opening tag and a closing tag.

index.html
<!-- Opening and closing tags with content -->
<p>This is a paragraph.</p>

<!-- Self-closing tags (no separate closing tag required) -->
<br>
<hr>
<img src="photo.jpg" alt="A photo">

Tag Syntax Rules

Opening Tag: <tagname> — Starts an element
Content: The content between opening and closing tags
Closing Tag: </tagname> — Ends an element (note the forward slash /)
Empty / Self-closing: <br>, <img>, <hr> — Elements without text content
⚠️
HTML tags are NOT case-sensitive: <P> and <p> are identical. However, it is standard industry best practice to always write tags in lowercase.

HTML Attributes

Attributes provide additional information about HTML elements. They are always specified in the opening tag and usually come in name="value" pairs.

index.html
<!-- href attribute for hyperlinks -->
<a href="https://knobly.com" target="_blank">Visit Knobly</a>

<!-- src and alt attributes for images -->
<img src="flower.jpg" alt="Beautiful Rose" width="300" height="200">

<!-- id and class attributes for styling and JS -->
<div id="header-container" class="main-card">
    <p class="highlight-text">Styled text</p>
</div>

<!-- title attribute for tooltip on hover -->
<p title="Click to view details">Hover over this text!</p>
AttributeDescriptionUsed With
hrefSpecifies the URL of a hyperlink<a>
srcSpecifies the path to an image or media file<img>, <script>, <audio>
altAlternative text if image cannot load<img>
width / heightSets width and height in pixels or %<img>, <table>, <iframe>
idUnique identifier for an element on the pageAll elements
classCSS class name(s) for styling and groupingAll elements
styleInline CSS styles applied directlyAll elements
titleExtra info displayed as a tooltip on hoverAll elements
targetWhere to open link (_blank = new browser tab)<a>
typeType of input element (text, email, password, etc.)<input>, <button>
placeholderHint text shown inside empty input fields<input>, <textarea>
requiredSpecifies that field must be filled before submitting<input>, <select>

Common HTML Tags Quick Reference

A quick reference of the most frequently used basic HTML tags:

<h1> - <h6>

Headings (h1 = largest, h6 = smallest)

<p>

Paragraph text block

<a>

Hyperlink to another page or section

<img>

Embeds an image

<br>

Line break (single space line)

<hr>

Horizontal divider line

<b> / <strong>

Bold text / Important emphasis

<i> / <em>

Italic text / Emphasized text

<u>

Underlined text

<ul> / <ol>

Unordered (bullet) and Ordered (numbered) lists

<li>

List item within ul or ol

<div>

Block-level container element

<span>

Inline container element

<table>

Tabular data grid

<form>

User input submission form

<input>

Interactive input control

<button>

Clickable action button

<textarea>

Multi-line text input field

HTML Comments

Comments in HTML are used to insert notes in your code that are NOT displayed in the browser. They help developers understand and document the code.

index.html
<!-- यह एक सिंगल-लाइन टिप्पणी है -->
<p>यह पैराग्राफ ब्राउज़र पर दिखाई देगा।</p>

<!--
    यह एक बहु-पंक्ति टिप्पणी है।
    यह कई लाइनों तक फैल सकती है।
-->

<!-- <p>यह पैराग्राफ छुपा हुआ है (commented out)।</p> -->
✅
Comments are handy for debugging. You can "comment out" lines of code to test alternatives without permanently deleting your work.

Creating Your First Web Page

Follow these 4 simple steps to create and run your very first HTML page locally:

Step-by-Step Guide

1
Open a Text Editor

Open Notepad on Windows, TextEdit on Mac, or install VS Code.

2
Write HTML Code

Type or paste the complete HTML document skeleton into your editor.

3
Save with .html Extension

Save as index.html. Ensure "Save as type" is set to "All Files (*.*)".

4
Double Click to Open in Browser

Double-click the saved file to open it in Chrome, Edge, Firefox, or Safari!

index.html
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>My First Website</title>
</head>
<body>
    <h1>Welcome to My First Web Page!</h1>
    <p>I am learning HTML on Knobly Web Platform.</p>
    <hr>
    <h2>About Me</h2>
    <p>I am a web development student preparing for O-Level M2-R5 exam.</p>
    <h2>My Hobbies</h2>
    <ul>
        <li>Coding</li>
        <li>Learning Web Design</li>
        <li>Reading</li>
    </ul>
    <p><a href="https://knobly.com" target="_blank">Visit Knobly</a></p>
</body>
</html>

HTML5 New Features

HTML5 is the modern web standard. It introduced new semantic elements, native multimedia tags, and advanced form inputs:

New Semantic Elements

<header>— Top header of page or section
<nav>— Navigation link container
<main>— Primary content area of document
<section>— Thematic section of content
<article>— Self-contained article or blog post
<aside>— Sidebar or tangential content
<footer>— Footer with copyright and links
<figure>— Illustrated figure with caption

Native Multimedia Elements

<audio> — Play audio directly in the browser
<video> — Play video files natively without third-party plugins
<canvas> — Draw dynamic 2D/3D graphics with JavaScript
<svg> — Render crisp scalable vector graphics at any screen size

New Form Input Types

type="email"Email validation
type="url"URL validation
type="number"Numeric counter
type="date"Date picker
type="time"Time picker
type="color"Color picker
type="range"Slider control
type="search"Search input

HTML vs CSS vs JavaScript

Modern web pages are built using three foundational technologies that work together harmoniously:

🏗️

HTML

Structure & Content

Defines what appears on the page — headings, paragraphs, images, links, forms

🎨

CSS

Styling & Design

Defines how things look — colors, typography, layout, animations, responsive grid

⚡

JavaScript

Behavior & Logic

Defines what happens — click events, validation, animations, API requests

💡
Think of it like a building: HTML is the concrete structure and bricks, CSS is the paint, styling and interior decoration, and JavaScript is the electricity and plumbing that makes everything function interactively.
Next Module

Element and Tag Reference →

Complete reference covering all HTML tags with examples and practice

Hi! 👋
KnoblyAI
Online

Hello! 👋

Your futuristic AI learning companion

KnoblyAI can make mistakes. Double-check important replies.