# HTML Document Essentials

> Elements, attributes, the document skeleton, text, links, images and tables: the raw material of every page. Free notes, key concepts, resources and a mini...

Canonical: https://www.internhack.in/roadmaps/tracks/frontend/html-document
Last updated: 2026-11-28

Elements, attributes, the document skeleton, text, links, images and tables: the raw material of every page.

Beginner · about 5 hours · difficulty 1/5

Learn first: [How Browsers Render a Page](https://www.internhack.in/roadmaps/tracks/frontend/browser-rendering)

HTML describes **what content is**, not how it looks. A browser reads tags like `<h1>`, `<p>` and `<a>` and builds a tree of elements from them.

### The skeleton

Every page needs `<!doctype html>` (standards mode), an `<html lang="en">` root, a `<head>` with `<meta charset="utf-8">`, the viewport meta tag (`width=device-width, initial-scale=1`) and a `<title>`, then a `<body>` with visible content. Forgetting the viewport tag is the classic reason a site looks tiny on phones.

### Everyday elements

- Text: headings `<h1>` to `<h6>` (in order, no skipping for styling), `<p>`, `<strong>`, `<em>`, lists `<ul>`/`<ol>`/`<li>`.
- Links: `<a href>` with meaningful text; use `target="_blank"` sparingly.
- Media: `<img src alt width height>` (always set `alt`, and dimensions to avoid layout shift), `<picture>`, `<video>`, `<audio>`.
- Tables for **tabular data only**, with `<th>`, `<thead>`, `<caption>`.

### Attributes and nesting

Attributes configure elements (`id`, `class`, `href`, `data-*`). Block-level vs inline is now a CSS concern, but invalid nesting (a `<div>` inside a `<p>`) still produces surprising DOM trees because the parser auto-closes tags.

### Pitfalls

- Using `<br>` or empty paragraphs for spacing (use CSS).
- `<div>` and `<span>` everywhere with no meaning.
- Missing `alt`, or alt text like "image of".

Move on once you can hand-write a multi-section page from memory and it passes the W3C validator with no errors.

## Key concepts

- **Doctype, head and body**
- **Viewport and charset meta tags**
- **Headings, paragraphs and lists**
- **Links and navigation**
- **Images, alt text and media**
- **Tables for data**
- **Global and data-\* attributes**
- **HTML validation**

## Mini project

Hand-write a personal profile page with a bio, a list of skills, a table of projects and embedded images, then run it through the W3C validator until it reports zero errors.

## Check yourself

What goes wrong on mobile if you forget the viewport meta tag, and why?

## Free resources

- [HTML: HyperText Markup Language](https://developer.mozilla.org/en-US/docs/Web/HTML) (MDN)
- [Learn HTML](https://web.dev/learn/html) (web.dev)
- [W3C Markup Validation Service](https://validator.w3.org/) (W3C)

Previous: [How Browsers Render a Page](https://www.internhack.in/roadmaps/tracks/frontend/browser-rendering) · Next: [Semantic and Accessible HTML](https://www.internhack.in/roadmaps/tracks/frontend/semantic-html)

## More in Writing Meaningful HTML

- [HTML Document Essentials](https://www.internhack.in/roadmaps/tracks/frontend/html-document)
- [Semantic and Accessible HTML](https://www.internhack.in/roadmaps/tracks/frontend/semantic-html)
- [HTML Forms and Native Validation](https://www.internhack.in/roadmaps/tracks/frontend/html-forms)
- [SEO and Metadata Basics](https://www.internhack.in/roadmaps/tracks/frontend/seo-basics)

## Related

- [Roadmaps](https://www.internhack.in/roadmaps)
- [Frontend Developer Roadmap](https://www.internhack.in/roadmaps/tracks/frontend)
