HTML Introduction
HTML stands for Hyper Text Markup Language. It is the standard language used to create and structure web pages. Every website you see on the internet is built using HTML.
What is HTML?
- HTML is the standard markup language for web pages
- HTML describes the structure of a page
- HTML consists of elements
- HTML works together with CSS and JavaScript
Note: HTML is not a programming language.
It does not perform logic or calculations.
It is used only to structure content.
Why Learn HTML?
- HTML is the foundation of web development
- It is easy to learn and understand
- Required for learning CSS and JavaScript
- Used in frontend, backend, and full-stack development
HTML Page Structure
A basic HTML document has a fixed structure that tells the browser how to display the content.
Example
<!DOCTYPE html> <html> <head> <title>Page Title</title> </head> <body> <h1>My First Heading</h1> <p>My first paragraph.</p> </body> </html>Try this code
Example Explained
- <!DOCTYPE html>
This declaration tells the browser that the document is written in HTML5. -
<html>
This is the main container of an HTML page. All content must be inside it. -
<head>
The head section contains information about the page like title and meta data. -
<title>
Defines the page title shown in the browser tab. -
<body>
Contains all visible content such as text, images, links, and tables. -
<h1>
Used to define the main heading. -
<p>
Used to define a paragraph.
What is an HTML Element?
An HTML element consists of a start tag, content, and an end tag.
General Syntax
<tagname> Content goes here </tagname>
Examples
<h1>My First Heading</h1>
<p>My first paragraph.</p>
HTML Element Structure
| Start Tag | Content | End Tag |
|---|---|---|
| <h1> | My First Heading | </h1> |
| <p> | My first paragraph | </p> |
| <br> | none | none |
Note: Some HTML elements do not have closing tags. These are called
empty elements, such as
<br> and <img>.