HTML Introduction
HTML is the standard language for creating web pages.
What is HTML?
- HTML stands for HyperText Markup Language
- HTML describes the structure of a web page
- HTML is made of elements, and each element tells the browser what a piece of content is
- Elements label content as "this is a heading", "this is a paragraph", "this is a link", and so on
A Simple HTML Document
Example
<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<body>
<h1>My First Heading</h1>
<p>My first paragraph.</p>
</body>
</html>Try it Yourself »The example explained
| Line | What it does |
|---|---|
<!DOCTYPE html> | Tells the browser this is a modern HTML5 page |
<html> | The root element that wraps the whole page |
<head> | Holds information about the page, not shown in the page itself |
<title> | The text shown in the browser tab and in Google results |
<body> | Holds everything visible: headings, text, images, links |
<h1> | A large main heading |
<p> | A paragraph of text |
What is an HTML Element?
An element usually has a start tag, some content, and an end tag:
Example
<tagname>Content goes here...</tagname>For example:
Example
<h1>My First Heading</h1>
<p>My first paragraph.</p>The end tag has a slash / before the tag name. Some elements, like <br> (a line break), have no content and no end tag. These are called empty elements.
Tag names are not case sensitive, but always write them in lowercase. It is the common practice and makes your code easier to read.
How a Browser Shows HTML
A web browser (Chrome, Edge, Firefox, Safari) reads the HTML file from top to bottom and shows the content. It does not show the tags themselves; it uses them to decide how to display each part.
Only the content inside <body> appears on the page. The <title> appears in the browser tab.
A Short History
| Year | Version |
|---|---|
| 1991 | Tim Berners-Lee invents HTML |
| 1999 | HTML 4.01 |
| 2014 | HTML5 becomes the official standard |
| Today | HTML is updated continuously as a "living standard" |
This tutorial teaches modern HTML5.
Exercise
Exercise
Which part of an HTML page is shown inside the browser window?
