The Runtime Theory
Web Development

HTML, CSS, and JavaScript: The Three Layers

How HTML provides structure, CSS provides presentation, and JavaScript provides behavior in every web page.

The Runtime Theory Team1 min read
▸ On this page

HTML, CSS, and JavaScript: The Three Layers

Every web page is built on three layers:

HTML — Structure

HTML (HyperText Markup Language) defines the page's structure. Headings, paragraphs, lists, links, forms, and images are marked up so the browser knows what each piece is for.

html
<h1>Hello, World</h1>
<p>This is a paragraph.</p>
<a href="/about">About</a>

CSS — Presentation

CSS (Cascading Style Sheets) controls how HTML elements look: colors, fonts, spacing, layout. Separation of concerns means HTML focuses on structure while CSS handles the visual design.

css
h1 { color: blue; }
p { font-size: 16px; }

JavaScript — Behavior

JavaScript adds interactivity. It can modify both the HTML and CSS after the page loads, respond to user clicks, fetch data from servers, and animate elements.

js
document.querySelector('h1').addEventListener('click', () => {
  alert('Clicked!');
});

The three-layer model keeps concerns separated, making web pages easier to build, debug, and maintain.

Not started

Sign in to save your learning progress.

Sign in to save