The foundation of web development
HTML (HyperText Markup Language) is the standard markup language for documents designed to be displayed in a web browser. It defines the structure and content of web pages.
Every HTML document follows a basic structure. Here's a simple template:
<!DOCTYPE html> - Defines the document type
<html lang="en"> - The root element of an HTML page
<head> - Contains meta information about the document
<title>Page Title</title> - Specifies a title for the document
</head>
<body> - Contains the visible page content
<h1>My First Heading</h1> - Defines a large heading
<p>My first paragraph.</p> - Defines a paragraph
</body>
</html>
You don't need any special tools to write HTML. You can start with:
// Install VS Code (optional but recommended)
// Download from: https://code.visualstudio.com/
Create a new file named "index.html" with the following content:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>My First HTML Page</title>
</head>
<body>
<h1>Hello World!</h1>
<p>This is my first HTML page.</p>
</body>
</html>
To view your HTML page:
You can also use live server extensions in VS Code to automatically reload changes.
HTML consists of many elements that define the structure and content of a web page. Here are some of the most important ones:
HTML5 introduced semantic elements that clearly define their content:
| Element | Description |
|---|---|
| <header> | Defines a header for a document or section |
| <nav> | Defines navigation links |
| <section> | Defines a section in a document |
| <article> | Defines an independent, self-contained content |
| <aside> | Defines content aside from the page content |
| <footer> | Defines a footer for a document or section |
| <main> | Specifies the main content of a document |