In this lesson
A page is text with markup.
A page has three layers: markup (HTML), style (CSS) and program (JavaScript). At the end, you write your first file.
- Say what each layer does
- Tell the file that arrived apart from the tree the browser builds
- Write a basic HTML file, done properly
The three layers
Think of a house. HTML is the structure: walls, doors, windows. CSS is the paint and the decoration. JavaScript is the wiring: it makes things move.
HTML is a markup language. Each piece of text gets a name: heading, paragraph, list, link. Tim Berners-Lee's list of tags, from 1992, already worked this way. "HTML5" is just a marketing name, and there is no "HTML6" to wait for.
CSS takes care of color, size and font. A rule has a selector, a property and a value: h1 { color: #2D4A7C; } gives every main heading that color. When the browser, the person reading and the author disagree, the "cascade" decides who wins.
By default, CSS blocks the page from being painted until it is ready, so nobody sees the page "naked" for an instant.
JavaScript is the program. It was created by Brendan Eich in 1995, and today it runs on 98.9% of sites, according to W3Techs.
What the pros know
The browser does not show the HTML file the way it arrived. It reads the file and builds a tree of objects in memory, the DOM. JavaScript changes that tree, not the file. That is why, when a program changes a piece of text, the original HTML (Ctrl+U) stays the same and the DOM becomes different. In Chrome's tools, right-click the element, choose Inspect, and the Elements tab shows the current tree. People who debug sites look at the tree, because the tree is what the visitor sees.
Working in every browser
The three engines from lesson 4 follow the same standard, but they implement it at different paces. That is why Interop exists: a yearly project run by the companies that make browsers, with tests and a public dashboard. "It works in Chrome" does not mean "it works". People who build pages test in all three.
Measure instead of guessing
Google publishes three measurements of user experience, the Web Vitals. PageSpeed Insights measures all three, for free, on any public address.
| Measurement | What it measures | Good limit |
|---|---|---|
| LCP | When the largest block appears | Up to 2.5 s |
| INP | Time to respond to a tap | Up to 200 ms |
| CLS | How much the content jumps | Up to 0.1 |
Accessibility: the alt attribute
The WCAG 2.2 standard requires alternative text for every image that carries information. Brazil's Inclusion Law, the Lei Brasileira de Inclusão (article 63), makes accessibility mandatory on the sites of companies with headquarters or representation in Brazil. In February 2026, WebAIM found images with no alternative text on 53.1% of one million home pages. Write what the image shows: "Bakery logo: a loaf of bread on a blue background".
Your first file
Copy this into a plain text editor, save it as mysite.html and open it in the browser.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>My first page</title>
</head>
<body>
<h1>My first page</h1>
<p>Written by hand and opened in the browser.</p>
</body>
</html>
- lang="en": the screen reader uses the right voice.
- charset="utf-8": keeps "café" from turning into "café".
- viewport: the phone uses the real width of the screen.
Practice · 5 min
- Create the file mysite.html with the code above and open it in the browser.
- Press F12, find the heading in the Elements tab and edit the text. Check with Ctrl+U that the source code has not changed.
- Paste the address of a site you use into PageSpeed Insights and write down LCP, INP and CLS on mobile.
Summary
- HTML marks what each piece is. CSS decides how it looks. JavaScript makes it move.
- The browser builds the DOM. Ctrl+U shows what arrived, Elements shows the live tree.
- Good: LCP up to 2.5 s, INP up to 200 ms, CLS up to 0.1.
- Every image that carries information gets alternative text.
Sources
Read on October 30, 2026.
- WHATWG. HTML Living Standard and DOM Living Standard.
- Tim Berners-Lee. HTML Tags (1992).
- Brendan Eich. Popularity, on the creation of JavaScript.
- WebAIM. The WebAIM Million 2026, and Google, Interop 2026.
- W3Techs. Client-side JavaScript.
- Google. DOM in DevTools and Chrome shortcuts (Ctrl+U).
- Google. Web Vitals and DevTools shortcuts.
- W3C, WCAG 2.2, criterion 1.1.1, and Brazil, Lei 13.146/2015, art. 63.
Lesson quiz
Three situations to apply what you learned.
Isaque Victor free courses