Demo mode This site is not live. It is currently being tested and developed. Nothing on here represents an offer.
← Exit course WEB-101 Web Development for Beginners: HTML and CSS
Course progress, 0 of 8 parts done0%
Practical work

5 tasks, about 7.5 hours

Download as PDF

Set up a workstation and build a first three-file page, trace page loads on three South African websites, read addresses, redirects and status codes, take two pages apart in the developer tools and map web roles.

These five tasks set up the tools you will use for the rest of the course, and put the lesson to work on real websites. Together they take about seven and a half hours, so spread them over several sittings. You need your computer, a current version of Chrome, Edge or Firefox, an internet connection, and a plain text file of notes. Keep every note you write: later modules refer back to them.

Task 1: Set up your workstation and build a first page

This task gets your tools working and has you build a tiny page from all three languages, so you see them work together before you study each one.

  1. Install Visual Studio Code, following the steps in the lesson for Windows or Linux Mint. On Windows, turn on file name extensions in File Explorer.
  2. Create a folder called bakery-site in your Documents folder and open it in VS Code with File, then Open Folder. Turn on Auto Save from the File menu.
  3. Create a file called notes.txt in the folder, type the heading "Module 1 notes" and save it. Use this file for every task in this module.
  4. Create three more files in the folder, named exactly index.html, styles.css and script.js. Type the code below into them, one listing per file. Type it rather than copying it: noticing every bracket and quote is part of the learning. Module 2 explains every line of the HTML.
index.html
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <title>Thandeka's Bakery</title>
  <link rel="stylesheet" href="styles.css">
</head>
<body>
  <h1>Thandeka's Bakery</h1>
  <p id="hours">Open Monday to Saturday, 6am to 2pm</p>
  <button id="order">Order a cake</button>
  <script src="script.js"></script>
</body>
</html>

For styles.css and script.js, type the two listings from the lesson section "HTML, CSS and JavaScript: one job each".

  1. Open index.html in your browser by double-clicking it in your file manager. Click the button and check that its text changes.
  2. Make three changes and reload the page after each: change the opening hours in the HTML, change the heading colour in the CSS to #2369AE, and change the thank-you message in the JavaScript.
  3. Now break things on purpose, one at a time, and record what happens: rename styles.css to style.css and reload, then rename it back. Do the same with script.js and click the button. Open the developer tools while each file is missing and look at the Console and Network panels.

What you produce: a working three-file page in your bakery-site folder, and notes describing what happened when the stylesheet and the script were missing, and what the developer tools showed.

How to check: with all three files named correctly, the heading is blue and the button's text changes when you click it.

Time: 1 hour 30 minutes.

Task 2: Trace page loads on three South African websites

Choose three sites: www.gov.za, a South African news site and a South African online shop. For each one:

  1. Open the developer tools, select the Network panel and tick Disable cache, so every file is downloaded fresh.
  2. Reload the page and wait until the list stops growing.
  3. From the summary at the bottom of the panel, record the number of requests, the amount of data transferred and the time the page took to finish loading.
  4. Use the type filters to count the requests for documents, stylesheets, scripts, images and fonts.
  5. Record the name and status code of the first request, and any request whose status code does not start with 2.

Then choose the slowest of the three and load it again with network throttling switched on. In Chrome and Edge, the throttling menu is at the top of the Network panel and normally says "No throttling". In Firefox it is the menu marked "No Throttling". Choose a slow mobile preset such as "Slow 4G" or "Regular 3G" and record the new load time.

What you produce: a table in your notes with one row per site and columns for requests, data transferred, load time, and the count of each file type, plus the throttled load time and two or three sentences on what makes one page heavier than another.

Time: 1 hour 40 minutes.

Task 3: Read addresses, redirects and status codes

  1. Split each of these addresses into scheme, domain name, path and, where there is one, query string. Record them in a table.
    • https://www.thandekasbakery.co.za/menu/breads.html
    • https://www.sars.gov.za/
    • https://www.gov.za/services
    • https://shop.example.co.za/search?q=school+shoes
    • http://www.thandekasbakery.co.za/cakes/order.html?size=large
  2. Open the Network panel, tick Preserve log (Chrome and Edge) or Persist Logs (Firefox, in the settings cog), and visit http://gov.za, typed with plain http and no www. Record every request in the chain before the page itself arrives, with its status code, and explain what happened in one sentence.
  3. With the Network panel still open, visit a path that does not exist on a site you know, such as https://www.gov.za/thandeka-cake-menu. Record the status code of the first request.
  4. Find the IP address of a server yourself. On Windows, open Command Prompt from the Start menu and type ping -n 1 www.gov.za. On Linux Mint, open the Terminal and type ping -c 1 www.gov.za. The number in square brackets (Windows) or round brackets (Linux) is the IP address DNS gave your computer. It does not matter if the replies themselves time out: many servers ignore ping, but the address is still looked up first.

What you produce: the table of five addresses split into their parts, the redirect chain with its status codes and your explanation, the 404 status you saw, and the IP address you found, with a sentence saying which step of the page load from the lesson each of these shows.

Time: 1 hour 15 minutes.

Task 4: Take two pages apart

Choose two websites with very different looks, such as a news site and a small business's site. For each one:

  1. Use the element picker in the developer tools to find the page's main heading, its main navigation menu and its footer. For each, record the name of the element, the word right after the opening <, such as h1, nav, footer or div.
  2. Select the main heading and record three CSS properties that apply to it, with their values, for example font-size: 32px.
  3. Switch off one of those properties by unticking it, and describe what changed on the page.
  4. Turn on the device toolbar with Ctrl+Shift+M (Chrome and Edge call it the device toolbar, Firefox calls it Responsive Design Mode). Set the width to 375 pixels, the width of a typical phone, and record at least three things that change in the layout.
  5. Open the Console and record how many errors and warnings it shows.

What you produce: for each site, the element names of the heading, navigation and footer, three CSS properties of the heading, what happened when you switched one off, three layout changes at phone width, and the console counts. End with two sentences comparing how well the two sites are built, based on what you found.

Time: 1 hour 30 minutes.

Task 5: Map the layers and the roles

  1. An online shop that sells school uniforms has the eight features below. For each one, decide whether the work is done mainly by the front end, the back end or the database, and give a one-line reason. Where more than one layer is involved, name the main one and mention the others.
    1. The product photos are arranged in two columns on a phone and four on a laptop.
    2. When you choose a blazer size, the price shown on the page changes immediately.
    3. The shop remembers your order history from last year.
    4. When you log in, the shop checks that your password is correct.
    5. A message says "Only 3 left in size 32" next to a pair of trousers.
    6. A pop-up asks "Are you sure?" when you click Remove on an item in your cart.
    7. After payment, the shop works out the delivery fee from your postal code and the parcel weight.
    8. The search box suggests "school jersey" as you type "jer".
  2. Choose one online service you use yourself, such as your bank's website, an online shop or a municipal payment site. List six features you can see, and label each with its layer in the same way.
  3. Find three advertisements for web development jobs on a South African job site. For each, record the job title, which role from the lesson's table it matches most closely, and the languages and tools the advertisement asks for. Then write a short paragraph on which role interests you most at this stage, and why.

What you produce: the eight labelled shop features with reasons, six labelled features of a service you use, a table of three job advertisements, and your paragraph on the role that interests you.

Time: 1 hour 30 minutes.

Show the model answer

Task 1: Set up your workstation and build a first page

Check your set-up against this list. Every item should be true before you start Module 2.

  • VS Code opens and shows BAKERY-SITE at the top of the Explorer pane, with index.html, notes.txt, script.js and styles.css underneath. VS Code shows folder names in capitals there, which is normal.
  • On Windows, File Explorer shows the extensions, so you can see .html, .css and .js.
  • The page shows a heading, a line of opening hours and a coral button. After your change, the heading is blue.

What you should have recorded when you broke things:

  • Stylesheet missing. The page still shows all its content, but in the browser's plain default style: black serif heading, grey default button. The Network panel shows a red row for styles.css with status 404, or a "failed" note, because the HTML asks for a file that is not there. This is the lesson's point in action: remove the CSS and the content survives.
  • Script missing. The page looks normal, but clicking the button does nothing. The Network panel shows script.js failing to load, and the Console shows a message that the file could not be loaded.

If the button does nothing even when all three files are present, open the Console. A red error naming script.js and a line number usually means a typing mistake, such as a missing bracket or quote. Compare your line with the listing character by character.

Task 2: Trace page loads on three South African websites

Websites change constantly, so your numbers will differ from anyone else's. Check that your notes show these things:

  • The first request is the HTML document, of type "document" with status 200. If it shows 301 or 302, the server sent you on to a slightly different address first, and the next row is the document itself.
  • Dozens of requests per page. A government home page commonly needs several dozen requests, and a news or shopping home page often well over a hundred. Images and scripts are usually the biggest groups.
  • Each file type matched to its language. Stylesheets are CSS, scripts are JavaScript, the document is HTML, and fonts and images are files the HTML or CSS asks for.
  • A much longer load time under throttling. A page that loads in two seconds on a fast connection can take ten seconds or more on a slow mobile preset. The total data transferred is the main reason.

A good closing comment reads something like: "The news site transferred about five times as much data as gov.za, mostly scripts and images, many of them from advertising and analytics services. On slow mobile data that difference became a wait of many seconds." Many South Africans browse on prepaid mobile data, so page weight costs your visitors money as well as time.

Task 3: Read addresses, redirects and status codes

Model answer: five addresses split into their parts
AddressSchemeDomain namePathQuery string
1httpswww.thandekasbakery.co.za/menu/breads.htmlnone
2httpswww.sars.gov.za/ (the home page)none
3httpswww.gov.za/servicesnone
4httpsshop.example.co.za/searchq=school+shoes
5httpwww.thandekasbakery.co.za/cakes/order.htmlsize=large

Address 5 uses plain http, so the connection would not be encrypted. A properly run site redirects such an address to its https version.

  • The redirect chain. You should see one or more requests with a 3xx status, usually 301 or 302, before a request with status 200. Typically the plain http address is sent to the https address, and the address without www is sent to the one with it, sometimes in one step and sometimes in two. Your sentence should say that the server answered "look elsewhere" and the browser followed automatically.
  • The missing page. The first request shows 404. The server worked, but had nothing at that path.
  • The IP address. Any address in the form of four numbers separated by full stops is correct, such as 203.0.113.25 (an example only). It shows Step 2 of the page load, DNS. If ping said it could not find the host, check your spelling and your internet connection.

Task 4: Take two pages apart

  • Element names. Well-built sites usually use h1 for the main heading, nav for the main menu and footer for the footer. Many sites use div for some or all of these instead. Record what you actually found: a div is a correct observation, and Module 2 explains why the specific elements are better.
  • CSS properties. Typical answers are font-size, font-family, color, font-weight, line-height and margin, each with a value. Switching one off should change only how the heading looks, never its words.
  • At phone width, common changes are that the menu collapses into a single button, often drawn as three lines, columns stack into one, images shrink to the screen's width, and text sizes change. If nothing changes and you have to scroll sideways, the site was not built to respond to screen width. Module 3 teaches you how to build a page that does.
  • Console counts. Any number, including zero, is a correct observation.

A good comparison names evidence: "Site A uses nav and footer elements, reflows neatly at 375 pixels and has no console errors. Site B builds everything from div elements, needs sideways scrolling on a phone and shows eight console errors."

Task 5: Map the layers and the roles

Model answer: the school uniform shop
FeatureMain layerReason
a. Two columns on a phone, four on a laptopFront end (CSS)Layout, and how it adapts to screen width, is the job of CSS in the browser.
b. Price changes when you choose a sizeFront end (JavaScript)It changes instantly without a new page, so a script in the browser is doing it. The prices came from the back end when the page loaded.
c. Remembers last year's ordersDatabaseAnything kept across visits and devices is stored in the database, which the back end reads.
d. Checks your passwordBack endThis must happen on the server. Visitors can see and change anything running in the browser.
e. "Only 3 left in size 32"Database, through the back endStock levels are stored in the database. The back end reads them and puts the message in the page.
f. "Are you sure?" pop-upFront end (JavaScript)A question before anything is sent to the server is browser-side behaviour.
g. Delivery fee from postal code and weightBack endA rule involving money must be worked out on the server, where the visitor cannot change it.
h. Search suggestions as you typeFront end and back endJavaScript notices each keystroke and asks the server. The back end searches the database and sends suggestions back.

If you labelled b or f as back end, use the clue from the lesson: did a new page load? If not, the browser is doing the work. If you labelled d or g as front end, remember that anything involving security or money must be done, or checked again, on the server.

For your own service, apply the same tests to each feature: does it change instantly without a new page (front end), does it involve logins, money or rules (back end), and is it still there next time from another device (database)?

For the job advertisements, check that each one is matched to a role by what the work involves, not only by its title. An advertisement titled "Web Developer" that asks for HTML, CSS, JavaScript and a framework such as React is a front-end role. One that asks for PHP or Python and SQL is a back-end role. One that asks for both is full-stack. Many advertisements also ask for Git, which Module 5 introduces.