A page in HTML
4 minHTML names each part of a page. You'll see how the browser reads a page as a tree, then rebuild a poster made of divs with elements that do work for free.
Lesson video
Tastebud · 3:53 · Captions on screen
Choose the element that says what each part is, then use CSS to make it look right.
- Element
- One named part of a page, like h1 or a, written as an opening tag, its content and a closing tag.
- DOM
- The tree of elements the browser builds from your HTML. The Elements panel in Chrome's DevTools shows it.
- Why. Browsers, screen readers and search engines read the element's name and ignore its look. A <button> already works with Tab and Enter; a styled <div> doesn't.
- Real example. Google builds each result's blue title link from sources including the page's <title> and headings like <h1>, and advises putting the main title in the first visible <h1>. (Google Search, Nov 2026)
- When to break it. A control HTML has no element for, like a colour dial in a sketch, can be a <div> with a role and tabindex if you code its keys yourself.
- Common mistake. A <div> styled as the Buy button. It looks right, but Tab skips it and Enter does nothing, so people using a keyboard can't buy.
Our take. Tools that export a page as nested divs give you code you can't read or fix. Know a handful of named elements and you can check any generated page in a minute.
An element is a name with tags around it
Every part of a page is an element: an opening tag that names it, attributes that add detail, the content, then a closing tag. Elements nest inside each other, which is how a page becomes a tree.
One link, taken apart: the name, a detail, the content and the closing tag
- Opening tag: <a>. The name says what this is. a means a link.
- Attribute: href="#tickets". Extra detail inside the opening tag. href is the address the link goes to.
- Content: Get tickets, ₹299. What people see. It can be text or other elements nested inside.
- Closing tag: </a>. The same name with a slash. Everything between the two tags belongs to the link.
Divs look right and say nothing
Style the classes and both versions look the same on screen. Only the one built from named elements tells the browser what each part is, so only that one works for keyboard and screen reader users.
- Looks right, because CSS styles the classes
- Tab skips the ticket button
- A screen reader hears plain lines, no heading
- The date is text a calendar can't read
- <h1> marks the event name as the top heading
- <a href>: Tab reaches it, Enter opens it
- <ul> keeps the line-up together as a list
- <time datetime> carries a date software can read
What the right element gives you for free
Each named element comes with behaviour the browser already knows. Pick <button> and you get focus and key presses. Pick <h1> and screen readers can list it. Pick <title> and the tab and Google's result get your page's name.
Five elements that bring keyboard, screen reader and search support you'd otherwise code
- <button>. Tab reaches it, and Enter or Space presses it. A styled div does neither until you write the code.
- <a href>. A real link: it takes focus with Tab, and Enter follows it.
- <h1> to <h6>. Many screen readers list the headings, so people can jump around the page like a contents list.
- <title>. Names the browser tab, and Google draws on it for the search result's blue link.
- <time datetime>. A date in a form software can read, which can let a browser offer a calendar reminder.
Try it
Rebuild the poster as a page
A poster written for this lesson, built only from divs. Swap each div for the element that says what it is: main, h1, time, ul with li, and a link. Keep the class names. The checks tick as you go.
Tab adds two spaces. Press Esc, then Tab, to leave the editor.
- The poster sits in <main> (not yet)
- The event name is an <h1> (not yet)
- The date is a <time> with a datetime (not yet)
- The line-up is a <ul> of <li> items (not yet)
- Get tickets is a link with an href (not yet)
What to notice: The poster looks the same after every swap, because the CSS styles the class names. What changed is how the page reads. Press Tab in the preview: the ticket link now takes focus, and Enter follows it, which the div never did. A screen reader now hears a heading, a date, a list and a link.
Quick check
An AI coding tool built your event page, and the Book button is a <div> with a click handler. It works with a mouse. What do you change first?
Watch next
Watch it for A designer's view of HTML as the structure and CSS as the look, the same split the poster lab uses.
Watch it for Everything a plain <button> does for you that a clickable div makes you rebuild by hand, including focus and key presses.
Connects to: 1.4 A workspace and a portfolio from day one · 3.2 Figma to a clickable page · 3.3 Prototyping with an AI coding tool
Sources · checked Nov 2026
- MDN: HTML, a good basis for accessibilityButtons have built-in keyboard accessibility: Tab moves between them and Space, Return or Enter activates them; Enter follows a focused link; many screen readers list all headings as a table of contents; a div used as a button misses this
- MDN: ARIA button roleA div or span given role="button" needs tabindex to be focusable and handlers for Enter and Space; use <button> where possible
- Google Search Central: Influencing your title linksGoogle builds title links from sources including <title> elements, the main visual title and heading elements such as <h1>; advice to put the main title in the first visible <h1>
- MDN: The <title> elementThe title is shown in the browser's title bar or the page's tab
- MDN: The <time> elementThe datetime attribute gives a machine-readable date, which can help a browser offer to add an event to a calendar
- MDN: Using the Document Object ModelThe DOM represents a document as a logical tree of nodes
- Chrome for Developers: DevTools overviewThe Elements panel views and changes the DOM and CSS