📘 CodingMarble Learn

Web Development: How HTML, CSS and JavaScript Build a Web Page

A web page is a set of text files. The browser (client) asks a server for them using a URL and HTTP. HTML gives the page its structure: headings, paragraphs, links, images, lists, tables and forms. CSS gives style: colours, fonts, spacing and layout. JavaScript gives behaviour: it reacts to clicks and changes the page. Responsive design makes one page fit both phones and computers. Good pages are also accessible, fast and safe.

🎬 Step-by-step story

  1. You type an address. Your browser sends a request to a server. The server sends back the page files.
  2. HTML builds the structure. Each tag makes a box: header, nav, main, aside, footer.
  3. CSS adds style. The same boxes get colours, sizes and places. The HTML did not change.
  4. JavaScript adds behaviour. Press the button: the counter goes up without loading a new page.
  5. Responsive design: make the screen narrow and the columns stack one under another.
  6. Your turn: drag the width, switch CSS off and on, press the button.

Tip: drag the 3D scene to turn it. Use two fingers to zoom.

🤔 Common doubts, cleared

Where is a web page actually stored?

On a server. Your browser asks for it with a request and gets a copy of the files (step 1).

Is HTML a programming language?

No, it is a markup language. It labels parts of content; it has no loops or decisions.

If I change the CSS, do I have to change the HTML?

No. In step 3 the same HTML boxes get new colours and places.

Why does the page not reload when I press a button?

JavaScript changes the page in place through the DOM (step 4).

Do I need a separate site for phones?

No. Media queries let one page change its layout by screen width (step 5).

What happens if CSS fails to load?

The content is still there, shown in plain default style. Try switching CSS off in step 6.

How the web works: client, server, URL and HTTP

The World Wide Web is a huge set of linked pages kept on computers called servers. Your browser is the client.

Search engines visit pages, store their words and show you a list when you search. Use exact words, quotes for phrases, and check who wrote a page before you trust it.

HTML: the structure of a page

HTML (HyperText Markup Language) marks parts of the text with tags. Most tags come in pairs: <p>text</p>. A tag can have attributes, e.g. <a href="page2.html">.

Skeleton of every page

<!DOCTYPE html>, then <html> with a <head> (title, links to CSS) and a <body> (what you see).

Common tags

CSS: style and layout

CSS (Cascading Style Sheets) says how HTML should look. A rule has a selector and declarations: h1 { color: navy; font-size: 32px; }.

Responsive design

A media query changes the style for small screens: @media (max-width: 600px) { .cols { flex-direction: column; } }. Add the viewport meta tag so phones do not zoom out.

JavaScript, publishing and good practice

JavaScript runs inside the browser. It can react to events (click, typing), change text and styles through the DOM (the page as a tree of objects) and check forms before sending.

btn.addEventListener("click", () => { n++; out.textContent = n; });

Front end and back end

HTML, CSS and JavaScript in the browser are the front end. Programs and databases on the server are the back end. To publish a site, you upload the files to a web host and connect a domain name.

Good habits

Key formulas and definitions

Worked examples

1. Write HTML for a heading "My School" and a link to about.html with the text "About us".

<h1>My School</h1> then <a href="about.html">About us</a>. The href attribute holds the address; the text between the tags is what you click.

2. Write a CSS rule that makes every paragraph dark grey, 18 px, with 10 px space inside.

p { color: #333; font-size: 18px; padding: 10px; } Selector p chooses all paragraphs; each declaration is property: value;

3. A box has width 200 px, padding 10 px, border 2 px and margin 5 px on each side. How wide is it on screen, without the margin?

200 + 2×10 + 2×2 = 224 px. With margins it takes 224 + 2×5 = 234 px of space.

4. A page shows 3 columns on a computer but they are too thin on a phone. Fix it.

Wrap the columns in a flex container and add: @media (max-width: 600px) { .cols { flex-direction: column; } }. Below 600 px the columns stack. Also add <meta name="viewport" content="width=device-width, initial-scale=1">.

Common mistakes

Practice quiz

1. Which language gives a web page its structure?
2. Which tag makes a hyperlink?
3. In CSS, ".card" selects…
4. Status code 404 means…
5. Making one page fit phones and computers is called…

Practice: answer these yourself

Type or choose your answer, then press Check. Use a hint if you are stuck; the full solution appears after you answer.

Frequently asked questions

Which should I learn first: HTML, CSS or JavaScript?

Start with HTML, then CSS, then JavaScript. Each builds on the one before.

Do I need special software to make a web page?

No. Any text editor and a browser are enough. Code editors like VS Code just make it easier.

What is the difference between a website and a web page?

A web page is one document. A website is a group of linked pages under one domain name.

Where this is taught

ItalySecondaria di secondo grado – classe 3ªTools and foundations
ItalySecondaria di secondo grado – classe 4ªTools and foundations
PolandLiceum ogólnokształcące, klasa IIProgramming and solving problems with computers
RomaniaClasa a VIII-aWeb pages
RomaniaClasa a XII-aModule 4: Web programming (optional)
RomaniaClasa a XII-aUsing the computer and processing information – part 2
Ukraine9 класDigital creativity
Ukraine10 класBase module: multimedia and hypertext
Ukraine10 класElective: web technologies (35 h)
Ukraine11 класWeb technologies
Ukraine11 класElective: web technologies (35 h)
CBSE (India)Class 10HTML
CBSE (India)Class 11Website Building using HTML and CSS
FrancePremièreDigital tools and languages
Russia9 классDigital literacy

Learn first

Learn next

Related lessons

All Computer Science lessons