Single logo
  • Courses
  • Blog
  • About
Join on SkoolJoin on Skool

In this topic

React
  • One Request, Two Answers: the Same Post as an HTML Page and as JSON
  • A Blog Design from a Prompt: Downloading Figma Make Code and Reading App.tsx and BlogCard.tsx
  • How a Web Page Works: HTML Tags, Elements and Attributes
  • Semantic HTML: header, nav, main, aside and footer as Page Landmarks
  • HTML Forms: Labels, Names, Input Types and Where the Data Goes (GET vs POST)
  • CSS Basics: Selectors, Which Rule Wins, and the Box Model
  • CSS Flexbox vs Grid: A Nav Bar, a Card Row and a Dashboard
  • Responsive CSS: Viewport, Mobile-First Media Queries, clamp() and Dark Mode with Tokens
  • JavaScript for People Who Already Code: Syntax, Modules and Five Surprises
  • JavaScript Arrays the Functional Way: map, filter, reduce, find, sort and Object.entries
  • Async JavaScript: Promises, async/await, fetch and Promise.all
  • JavaScript in the Page: the DOM, querySelector and Events
  • npm, package.json and Vite: What npm install Fetches and How Vite Serves and Builds Your Page
  • TypeScript Essentials: Types Checked, Then Erased (Interfaces, Unions, Generics)
  • Why React, JSX and Components: The Page as a Function of Data
  • React Props and Composition: Data Down, Calls Up, Children in the Slot
  • Routing With React Router: One Page, Many Addresses
  • React Component Tests With Vitest and Testing Library: Test What the User Sees
  • End-to-End Tests for a React App With Playwright: A Full Dress Rehearsal
  • Why AI-Built Websites All Look the Same, and Four Levels That Fix It
  • Visual Hierarchy, Spacing and the 8-Point Grid: Tell the Eye What to Read First
  • Colour, Contrast and Dark Palettes: 60-30-10, Semantic Tokens and Ratios You Can Compute
  • Typography That Sells: Type Scale, Line Length and Free Font Pairings
  • The UI Element Catalogue: Buttons to Toasts, Their Jobs, States and shadcn/ui Names
  • Design Tokens: Primitive and Semantic Tokens, from Figma to CSS to Tailwind
  • Tailwind CSS 4 in React: Utility Classes, Responsive Prefixes, Hover and Dark Mode
  • shadcn/ui in React: Components You Own, Edit and Commit
  • Design Tokens to a Tailwind Theme: Light and Dark Mode with @theme inline
  • Motion in React: Entrance, Hover, Exit and Layout Animations
  • A React Dashboard: Stat Cards, a Recharts Line Chart and a Sortable Table
  • Accessibility in Practice: Dialogs, Menus and the Keyboard in React
  • Reference-Driven Design: Extract a DESIGN.md From a Site You Admire and Build From It
  • Components, Variants and Variables: One Design System in Figma and in CSS
  • Figma MCP Server: Build a React Component From a Frame, Then Write It Back
  • Claude Design: From a Brief to a Clickable Prototype, Then Hand It Off to Claude Code
  • Critiquing AI-Generated UI: Six Checks for Every Screen
  • The AI Design Landscape: Prompt to UI, Prompt to App, and Design to Code
  • Your Brand Rules Folder: One Folder Every AI-Built Page Follows
  • The Best-Practice UI Prompt: Plain Sentences That Beat the Average AI Page
  • UI Ideas From Figma Make, Google Stitch and ChatGPT: One Prompt, Three Designs
  • Google Stitch From a Sketch or Screenshot: Show the Layout, Say What to Keep
  • Stitch to Figma to Code: Turn a Stitch Screen Into Code That Uses Your Tokens
  • Figma Make: Prompt to Prototype With a Four-Part Prompt
  • Upgrade a Dated UI From One Screenshot (or a Reference Image)
  • States and Feedback: Make Every Click Get an Answer
  • A Design-Loop Skill: Claude Screenshots, Scores and Fixes Its Own UI
  • Copy Without the AI Tells: A Copy Pass on a Landing Page
  • React State, Events, Lists and Conditional Rendering: Follow One Click
  • React useEffect: When It Runs, What Cleanup Is For, and When You Don't Need One
  • Lifting State Up, Refs and React DevTools: Put State Where It Is Needed
  • Forms and Actions in React 19: Controlled Inputs, Form Actions, useActionState and useFormStatus
  • React Context and Custom Hooks: Share One Value, Reuse the Logic
  • Server State With TanStack Query: One Key, One Request, One Cache
  • Mutations and Optimistic Updates in TanStack Query: Change Data, Then Tell the Cache
  • Generate TypeScript Types, Query Hooks and Zod From an OpenAPI Spec With Orval
  • A Mock Backend in the Browser With Mock Service Worker, Generated From the Spec
  • A React Client for a FastAPI API: The CORS Wall, CORSMiddleware and the Vite Proxy
  • Forms With React Hook Form and Zod: The API's Rules in the Browser, the Server's Errors Under the Field
  • JWT Auth in a React Client With a FastAPI Backend: Log In, Carry the Token, Let the Server Decide
  1. Blog
  2. /
  3. React
  4. /
  5. Fundamentals

How a Web Page Works: HTML Tags, Elements and Attributes

A web page is a text file full of labelled pieces. Learn tags, attributes and nesting with three tiny pages, and see what breaks when an attribute or a closing tag is wrong.

Chaand Sheikh

·27 November 2026·Updated 28 November 2026Fundamentals

What you will learn

  • Explain what the browser does with an .html file
  • Name the four parts of an element: opening tag, attribute, content, closing tag
  • Nest elements correctly and write the standard page skeleton
  • Use headings, paragraphs, strong, em, img, lists and links

Before you start

  • A browser and any text editor

Think of a courier with a parcel. The courier never opens it. They read the label, see what's inside and where it goes, and handle it the right way.

An HTML tag is that label. It tells the browser what a piece of the page is: a heading, a paragraph, a link. An attribute is an extra line on the label, such as where a link goes or which picture to show. So a web page is just a text file full of labelled pieces, and the browser reads the labels and draws the page.

What the browser does with your file

You write a plain text file called index.html in any editor. The browser reads it from top to bottom, tag by tag: h1 means a big heading, p means a paragraph. Then it draws the page. The tags themselves disappear and only the result is left.

You don't need a server or anything installed. Double-click the file and Chrome opens it.

The four parts of one element

Here is one link, taken apart:

The element a href="schedule.html", course schedule, closing a, split into opening tag, attribute, content and closing tag. <a href="schedule.html"> course schedule </a> opening tag attribute: name="value" content closing tag all four together = one element
The opening tag names the piece, the attribute adds a detail, the content is what the reader sees, and the closing tag repeats the name with a slash.

The tag name sits inside angle brackets, and a means link. Inside the opening tag is an attribute, href="schedule.html", always written as name equals value. href is the address. Then comes the content, "course schedule", which is what you click. The closing tag </a> ends it.

Elements go inside other elements

Elements nest like boxes packed inside boxes. The rule is the one you'd follow with real boxes: the box you opened last, you close first.

<!-- good: strong closes before p closes -->
<p>A short course for <strong>complete beginners</strong>.</p>

<!-- wrong: the tags cross -->
<p>A short course for <strong>complete beginners.</p></strong>

Indent the inner tags by two spaces. The indentation then shows you the boxes at a glance.

Nested boxes: html holds head and body. head holds meta and title. body holds h1 and p. html head (facts, not drawn) meta charset title → tab body (what you see) h1 p
Every page has the same shape: one html box with a head and a body inside it.

Every page starts the same way

Here's the first example, the skeleton every page uses:

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>About the course</title>
</head>
<body>
  <h1>Web Basics</h1>
  <p>A short course for complete beginners.</p>
</body>
</html>

Line 1 says this is a modern HTML page, and lang="en" on the html tag says it's in English. Everything else goes inside html.

The head holds facts about the page that are not drawn on it. The title goes to the browser tab, so the tab reads "About the course". The body is what you see: one h1 heading and one p paragraph.

Headings, paragraphs and emphasis

The second file adds a bit more text:

  <h1>Web Basics</h1>
  <p>A short course for <strong>complete beginners</strong>.</p>

  <!-- a comment: the browser skips it -->
  <h2>What you will build</h2>
  <p>One small page, <em>written by hand</em>.</p>

h1 is the title of the page, one per page, and h2 starts each section under it. Inside a paragraph, strong means important and shows in bold, and em means stressed and shows in italics. The comment between the two parts is a note for you; the browser skips it. The same file also uses <br>, an empty element with no closing tag that just breaks the line.

Images, lists and links

The third file has the pieces you'll use on almost every page:

<body>
  <img src="course-logo.svg" alt="Web Basics logo" width="80">
  <h1>Web Basics</h1>

  <h2>What you will learn</h2>
  <ul>
    <li>Tags and attributes</li>
    <li>Links and images</li>
  </ul>

  <h2>How to join</h2>
  <ol>
    <li>Install a code editor</li>
    <li>Read the <a href="schedule.html">course schedule</a></li>
  </ol>
</body>

img is another empty element. src says which file to show, and alt gives the words for anyone who can't see the picture. ul is a bulleted list and each item is an li. If you want numbers, use ol instead, as the "How to join" steps do. And the link is our a again: the href is the address, the content is what you click.

Change one attribute, change the result

Click "course schedule" and the href takes the browser to schedule.html, a second page in the same folder.

Now break it. Change src="course-logo.svg" to src="logo.svg", a file that doesn't exist. There's no picture any more, and the browser shows the alt text, "Web Basics logo", in its place. The tag says what a piece is; its attributes say which file and which address.

One missing closing tag

In the second file, </strong> ends the bold, so only "complete beginners" is bold. Delete that closing tag and everything after it turns bold.

The browser shows no error message. It just guesses. So close every tag you open. Most editors type the closing tag for you as soon as you finish the opening one, which helps a lot.

Common mistakes

  • Crossed tags. Closing an outer box before the inner one. Close the inner tag first.
  • A missing closing tag. The style or meaning runs on into the rest of the page, silently.
  • A wrong file name in src or href. The image falls back to its alt text and the link leads nowhere. Check the spelling against the folder.
  • No alt on an image. Screen readers then have nothing to read out.

Quick recap

WordWhat it doesExample
Tagsays what the piece is<h1>, <p>, <a>
Attributesays where or which, as name="value"href="schedule.html", alt="..."
Elementopening tag + content + closing tag<a href="...">course schedule</a>
Nestingclose the inner box first<p><strong>..</strong></p>

Try it yourself

Make an about.html page with your name as the h1, two h2 sections, a paragraph with one strong word, a list of three hobbies, an image with alt text, and a link to a second page. Then give the page some real structure with the tags in semantic HTML and landmarks.

Tried the exercise? Share your answer or ask a question.

The StudyEasy AI Community is free to join, with the lesson files, notebooks and code.

Join free on Skool

Keep going in React · 3 of 59

Previous
A Blog Design from a Prompt: Downloading Figma Make Code and Reading App.tsx and BlogCard.tsx
Next post
Semantic HTML: header, nav, main, aside and footer as Page Landmarks

Related course on Udemy

The Python Architect Masterclass: Full Stack to AI Engineer

Python, Django, FastAPI, React, Docker, AWS, LLMs, RAG, agents and MCP, from first steps to AI engineer.View on Udemy ↗: The Python Architect Masterclass: Full Stack to AI Engineer (paid course, opens in a new tab)

Related posts

One Request, Two Answers: the Same Post as an HTML Page and as JSON

Ask a Django blog for the same post twice: once as a 12,731-byte HTML page built by a template, once as 2,976 bytes of JSON built by a serializer. Compare the headers, see who builds the page, and why the server still owns every write.

A Blog Design from a Prompt: Downloading Figma Make Code and Reading App.tsx and BlogCard.tsx

Make a blog design from a prompt in Figma Make, download src.zip, unzip it with Python's zipfile module, and read the two files that matter: App.tsx with its selectedPost state and BlogCard.tsx with its props.

Semantic HTML: header, nav, main, aside and footer as Page Landmarks

The same page written as div soup and with semantic tags looks identical, but only one gives screen readers and search engines landmarks and an outline. Plus tables, div, span and the one-main rule.

HTML Forms: Labels, Names, Input Types and Where the Data Goes (GET vs POST)

Follow a sign-up form's answers out of the page: label and id, name as the key, browser validation, the query string a GET form builds, and why POST hides it. Plus the most common bug, an input with no name.

On this page

  • What the browser does with your file
  • The four parts of one element
  • Elements go inside other elements
  • Every page starts the same way
  • Headings, paragraphs and emphasis
  • Images, lists and links
  • Change one attribute, change the result
  • One missing closing tag
  • Common mistakes
  • Quick recap
  • Try it yourself
Community · Free to join
Single logo

StudyEasy AI Community

Hosted onSkool

Learn AI engineering, share what you build, and connect with other learners.

  • Free resources: lesson files, notebooks and code

  • Ask questions and join engineering discussions

  • Meet real people learning and building with AI

Join free on Skool

Related course on Udemy

The Python Architect Masterclass: Full Stack to AI Engineer

Python, Django, FastAPI, React, Docker, AWS, LLMs, RAG, agents and MCP, from first steps to AI engineer.View on Udemy ↗: The Python Architect Masterclass: Full Stack to AI Engineer (paid course, opens in a new tab)

Single logo

Empowering Education, One Course at a Time

About
About usContact us
Legal
Terms of UsePrivacy Policy

© 2026 StudyEasy Organization. All rights reserved.