HTML Introduction
HTML is the standard markup language for building web pages. It describes the structure of a page using elements represented by tags.
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>My First Page</title>
</head>
<body>
<h1>Hello, world!</h1>
</body>
</html>
Setup & Editors
You only need a text editor (VS Code is popular) and a browser. Save files with a .html extension and open them in your browser.
Page Structure
- <head> metadata (title, meta tags, links)
- <body> visible content (headings, paragraphs, images, etc.)
- Use semantic tags like
<header>
,<main>
,<footer>
for better structure.
Headings & Paragraphs
There are six levels of headings from h1
to h6
. Use them to create a content hierarchy.
Links & Images
<a href="https://example.com">Visit site</a>
<img src="photo.jpg" alt="Description">
Always include meaningful alt text for accessibility.
Lists
<ul><li>Item</li></ul>
<ol><li>Step</li></ol>
Tables
<table>
<thead><tr><th>Name</th><th>Age</th></tr></thead>
<tbody><tr><td>Alex</td><td>22</td></tr></tbody>
</table>
Forms
<form>
<label>Email <input type="email" required></label>
<button>Submit</button>
</form>