What is HTML?
- HTML stands for Hyper Text Markup Language
- HTML is the standard markup language for creating Web pages
- 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 elements label pieces of content such as "this is a heading", "this is a paragraph", "this is a link", etc.
A Simple HTML Document
<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<body>
<h1>My First Heading</h1>
<p>My first paragraph.</p>
</body>
</html>
My First Heading
My first paragraph.
Example Explained
<!DOCTYPE html>
Declares the document type and version of HTML being used. It must be at the very beginning of the document.
<html>
The root element of an HTML page. Every other element is a descendant of this element.
<head>
Contains meta-information about the HTML document — like its title, character set, and links to stylesheets.
<title>
Specifies a title for the HTML page — shown in the browser's title bar or tab.
<body>
Contains the visible page content — headings, paragraphs, images, links, tables, etc.
<h1>
Defines a large heading. HTML has six levels of headings from <h1> to <h6>.
<p>
Defines a paragraph. Browsers automatically add space before and after each paragraph.
What is an HTML Element?
An HTML element is defined by a start tag, some content, and an end tag:
Examples of some HTML elements:
<h1>My First Heading</h1>
<p>My first paragraph.</p>
<br> element). These are called empty elements. Empty elements do not have an end tag!
Web Browsers
The purpose of a web browser (Chrome, Firefox, Safari, Edge) is to read HTML documents and display them correctly. A browser does not display the HTML tags, but uses them to determine how to display the document.
HTML Page Structure
Below is a visualization of an HTML page structure: