Unit 4 · Web Page Design Using HTML

4.1Introduction to HTML

How the web works (short version). When you type a web address in a browser, the browser (the client) sends a request over the internet to a computer called a web server. The server replies with files (HTML, CSS, JavaScript, images). The browser reads these files and draws the page. You will study this in depth in Unit 10.

www.example.comBrowser (client)Web server1. HTTP request: GET /index.html2. Response: HTML, CSS, JS, images3. The browser draws the page
How the web works: the browser (client) requests files and the web server sends them back

What is HTML? HTML stands for HyperText Markup Language.

HTML describes the structure and meaning of a page. CSS (Unit 6) describes how it looks. JavaScript (Unit 7) describes how it behaves.

Brief history. Tim Berners-Lee, the inventor of the World Wide Web, published the first description of HTML in 1991. The current standard is HTML5 (also called the HTML Living Standard), maintained by WHATWG.

Tags, elements and attributes.

HTML
<p class='intro'>Hello, world!</p>
<p class='intro'>Hello, world!</p>element (opening tag + content + closing tag)attribute: name='value'opening tagcontentclosing tag
Anatomy of an HTML element

Structure of every HTML document:

HTML
<!DOCTYPE html>
<html lang='en'>
<head>
  <meta charset='UTF-8'>
  <meta name='viewport' content='width=device-width, initial-scale=1.0'>
  <title>My First Page</title>
</head>
<body>
  <h1>Welcome</h1>
  <p>This is my first web page.</p>
</body>
</html>
PartPurpose
<!DOCTYPE html>Tells the browser this is an HTML5 document
<html lang='en'>Root element; lang helps screen readers and search engines
<head>Information about the page (not shown on the page itself)
<meta charset='UTF-8'>Character encoding so all languages display correctly
<meta name='viewport'...>Makes the page scale properly on phones
<title>Text shown on the browser tab
<body>Everything visible on the page
<!DOCTYPE html><html lang='en'><head><meta charset='UTF-8'><meta name='viewport' …><title>My First Page</title>Information about the page:not drawn in the page area<body><h1>Welcome</h1><p>This is my first…</p>Everything the user sees:text, images, links, forms
Every HTML document: the html root holds a head (information) and a body (visible content)

Rules to remember: Nest tags properly (close the inner tag before the outer). Use lowercase tag names. Always close non-void elements. Browsers ignore extra spaces and blank lines, so use indentation freely. Comments are written as <!-- comment -->.

Try it

  1. Install VS Code. Create a folder webdev and a file index.html.
  2. Type the full structure above. Save and open it in Chrome (or use Live Server).
  3. Change the title and heading. Refresh and observe.
  4. Deliberately remove a closing tag and see what the browser does.

Check yourself. The questions for this part are on the 4.2 Review Questions page, with answers to check your work.