Skip to content

Advanced Web Design – SS3 Digital Technologies Lesson Note (Second Term)

Lesson note at a glance

Class
SS3
Subject
Digital Technologies
Term
Second Term
Reading time
6 min
Start of this note, 1 of 7
Take this term’s notes offline
Reading here is free. Download all 7 SS3 Digital Technologies Second term notes as PDF to print and Word to edit.
Download all three terms, ₦2,000
Instant download. Secure payment by Paystack. Card, bank transfer, USSD or OPay. Payment stuck? WhatsApp us.

Advanced web design uses JavaScript to make a page react to the user and responsive design to make it fit any screen size.

Behavioural objectives

By the end of the lesson, students should be able to:

Advertisement
  1. explain what JavaScript is and state three things it can do;
  2. name common JavaScript events and say when each one happens;
  3. describe responsive design, fluid grids and flexible images;
  4. explain what a media query does;
  5. describe mobile-first design and the hamburger menu.

What is JavaScript?

JavaScript (JS) is a programming language that lets a website react to what the user does.

  • Static page: a page that just sits there like a poster on a wall, as with plain HTML and CSS.
  • Dynamic page: a page that changes or responds when the user acts, because JavaScript is running.
  • Without JavaScript: buttons would not respond, maps would not move and search bars would not suggest words as you type.

What can JavaScript do?

JavaScript can change content, check user input and create animations.

  • Change content: show a “Good Morning” message at 8:00 AM and “Good Evening” at 8:00 PM.
  • Validation: tell a user “This password is too short” before they press the submit button.
  • Animations: make menus slide out or images fade in.

How is JavaScript added to a web page?

JavaScript is added to a page in three common ways.

  • Inside a tag: written in an attribute such as onclick, for short actions.
  • Inside a script element: written between <script> and </script> in the HTML file.
  • In an external file: saved as a .js file and linked with <script src=”script.js”></script>.

What are JavaScript events?

An event is something that happens to a webpage, such as a click, a key press or a form being sent.

  • How JS uses events: the code waits and runs only when its event happens.
  • Doorbell example: the bell (the code) stays silent until someone presses the button (the event).
Advertisement

What are the common JavaScript events?

Event When it happens Example use
onclick A user clicks a button or an image. Show a thank-you message.
onmouseover A user’s mouse hovers over an area. Enlarge a picture.
onkeydown A user presses a key on the keyboard. Check what is typed in a search box.
onsubmit A user tries to send a form. Check that all fields are filled.
onload A page finishes loading. Show a welcome greeting.

What is a simple example of an event?

A button can show a message when it is clicked.

  1. Write a button in HTML.
  2. Add the onclick event to it.
  3. Put the action in quotes after the event.
  4. When the user clicks, the browser shows the alert box.

Example: <button onclick=”alert(‘Thanks for subscribing!’)”>Subscribe</button>

What is responsive design?

Responsive design is a way of building a website so that it looks good on any screen size.

  • Why it is needed: people once browsed on big desktop monitors, but today many use phones, tablets or even smartwatches.
  • Water example: water becomes the cup or the bowl it is poured into, and a responsive page fits the screen it is shown on.

How do we make a website responsive?

  1. Fluid grids: use percentages such as “50% of the screen” instead of fixed sizes such as “500 pixels wide”.
  2. Flexible images: tell images never to grow wider than the space they are in, for example with max-width: 100% in CSS.
  3. Media queries: apply different CSS rules to different screen sizes.
  4. Viewport setting: add <meta name=”viewport” content=”width=device-width, initial-scale=1.0″> in the head so phones use their real screen width.

What is the difference between a fluid grid and a fixed measurement?

A fixed measurement gives an element a set size in pixels, so it stays the same on every screen.

Advertisement

A fluid grid sizes elements as percentages, so they stretch or shrink with the screen. A fluid grid is also called a liquid layout.

Feature Fixed measurement Fluid grid
Unit used Pixels, such as 500px Percentages, such as 50%
On a small screen May be too wide, so the user must scroll sideways Shrinks to fit
On a large screen Stays the same size Stretches to fill the space

What are media queries?

A media query is a CSS rule that applies styles only when the screen meets a stated condition, such as its width.

  • Idea: it works like an “If/Then” rule for your CSS.
  • Plain English: “If the screen is narrower than a set width, hide the big sidebar and stack the menu buttons on top of each other.”
  • Code example: @media (max-width: 600px) { .sidebar { display: none; } }
  • Meaning of the example: when the screen is 600 pixels wide or less, the element with class sidebar is hidden.

How can a page of pictures change with screen size?

View Layout
Desktop view Show three columns of pictures.
Tablet view Show two columns of pictures.
Phone view Show one big picture at a time so it is easy to see.

What is mobile-first design?

Mobile-first design is the method of designing for the smallest screen first and adding features as the screen gets bigger.

  • Old method (desktop-first): design the desktop version, then shrink it for phones, which often made the phone version messy.
  • Modern method (mobile-first): start with the phone layout, which has the least space, then add more for larger screens.

What are the steps in mobile-first design?

  1. Plan the most important content for a small screen.
  2. Write the basic CSS for the phone layout.
  3. Add media queries, usually with min-width, for tablets.
  4. Add more media queries for desktops, with extra columns and features.
Advertisement

What is the hamburger menu?

The hamburger menu is a small icon of three horizontal lines that hides a website’s menu on small screens.

  • Big screen: there is space for a long menu such as Home, About, Services and Contact.
  • Phone: the same menu would take up the whole screen, so it is hidden behind the icon.
  • Role of JavaScript: JavaScript usually shows and hides the menu when the icon is clicked.
  1. The page loads on a phone with the menu hidden.
  2. The user clicks the three-line icon.
  3. The click event runs the JavaScript.
  4. The menu slides out.
  5. Clicking the icon again hides the menu.

Evaluation

  1. What is JavaScript, and what does it let a website do?
  2. State three things JavaScript can do on a webpage.
  3. What is an event? Name two common JavaScript events.
  4. What is the difference between a fluid grid and a fixed measurement?
  5. What is a media query used for?

Assignment

In your notebook, explain responsive design in your own words. Describe how a page of pictures should look on a desktop, a tablet and a phone. Then say why the hamburger menu is useful on a phone.

This term's Digital Technologies topics

SS3 Second Term · 7 topics

  1. Advanced Web Design
  2. Advanced Database Management
  3. Networking III
  4. Digital Project Management
  5. Emerging Tech III
  6. Revision of SSCE Past Questions I
  7. Revision of SSCE Past Questions II
Advertisement

Lesson Notes for Other Classes

Print it or edit it in Word

Every note is free to read online. A PDF or Word copy of one subject costs ₦1,000 for one term, or ₦2,000 for all three terms.

Sign in first, then choose your class and subject at checkout.