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
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:
- explain what JavaScript is and state three things it can do;
- name common JavaScript events and say when each one happens;
- describe responsive design, fluid grids and flexible images;
- explain what a media query does;
- 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).
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.
- Write a button in HTML.
- Add the onclick event to it.
- Put the action in quotes after the event.
- 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?
- Fluid grids: use percentages such as “50% of the screen” instead of fixed sizes such as “500 pixels wide”.
- Flexible images: tell images never to grow wider than the space they are in, for example with max-width: 100% in CSS.
- Media queries: apply different CSS rules to different screen sizes.
- 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.
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?
- Plan the most important content for a small screen.
- Write the basic CSS for the phone layout.
- Add media queries, usually with min-width, for tablets.
- Add more media queries for desktops, with extra columns and features.
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.
- The page loads on a phone with the menu hidden.
- The user clicks the three-line icon.
- The click event runs the JavaScript.
- The menu slides out.
- Clicking the icon again hides the menu.
Evaluation
- What is JavaScript, and what does it let a website do?
- State three things JavaScript can do on a webpage.
- What is an event? Name two common JavaScript events.
- What is the difference between a fluid grid and a fixed measurement?
- 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

