Web Design and Development
Web Design and Development
Authored by:
Ian King (Kelso High School)
Mark Tennant (Community School of Auchterarder)
Charlie Love (CompEdNet)
Andy McSwan (Knox Academy)
Reviewed by:
Jeremy Scott (George Heriot’s School)
Heriot-Watt University
Edinburgh EH14 4AS, United Kingdom.
First published 2018 by Heriot-Watt University.
This edition published in 2018 by Heriot-Watt University SCHOLAR.
Copyright © 2018 SCHOLAR Forum.
Members of the SCHOLAR Forum may reproduce this publication in whole or in part for educational
purposes within their establishment providing that no profit accrues at any stage, Any other use of the
materials is governed by the general copyright statement that follows.
All rights reserved. No part of this publication may be reproduced, stored in a retrieval system or transmitted
in any form or by any means, without written permission from the publisher.
Heriot-Watt University accepts no responsibility or liability whatsoever with regard to the information
contained in this study guide.
All brand names, product names, logos and related devices are used for identification purposes only and are
trademarks, registered trademarks or service marks of their respective holders.
v
Contents
1 Analysis 1
1.1 End User Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.2 Functional Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
1.3 Learning points . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
1.4 End of topic test . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
2 Design 7
2.1 Multi level sites . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
2.2 End-user requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
2.3 User interface design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
2.4 Learning points . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
2.5 End of topic test . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
3 Implementation: HTML 29
3.1 Revision . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
3.2 Semantic elements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
3.3 Form elements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
3.4 Learning points . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
3.5 End of topic test . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
4 Implementation: CSS 53
4.1 Revision . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
4.2 CSS Priorities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
4.3 Increasing efficiency in CSS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
4.4 Appearance and positioning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
4.5 Navigation bars . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
4.6 Learning points . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
4.7 End of topic test . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
5 Implementation: JavaScript 81
5.1 JavaScript . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83
5.2 HTML Document Object Model (DOM) . . . . . . . . . . . . . . . . . . . . . . . . 86
5.3 JavaScript Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
5.4 Three Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
5.5 Learning points . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96
5.6 End of topic test . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96
Glossary 122
© H ERIOT-WATT U NIVERSITY
1
Topic 1
Analysis
Contents
1.1 End User Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.2 Functional Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
1.3 Learning points . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
1.4 End of topic test . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
2 TOPIC 1. ANALYSIS
Prerequisites
• the term end users relates to the people who will use the website;
• the different types of end users of websites;
• that some users have specific requirements when browsing a website;
• the functional requirements of a website are the tasks that it must perform;
• the functional requirements can be used to evaluate if the completed site is fit for
purpose.
Learning objective
© H ERIOT-WATT U NIVERSITY
TOPIC 1. ANALYSIS 3
© H ERIOT-WATT U NIVERSITY
4 TOPIC 1. ANALYSIS
Example
The new user page should present the user with a form enabling them to create a new
account by entering username and email address. On submitting the form, the user receives
a welcome email containing a link to confirm the account. This link should take them to their
account details where they can perform the following tasks:
The welcome email will warn the user that their account will expire if they do not go to the link
and confirm their details within a certain time period.
The site should reject usernames or email addresses which belong to existing users.
The site should reject obscene or racist usernames.
The site should be secure.
© H ERIOT-WATT U NIVERSITY
TOPIC 1. ANALYSIS 5
a) a use case
b) a user scenario
c) a user story
d) system requirements
...............................................
Q2: Two activities that can be used to ensure user requirements are correctly understood
are:
...............................................
...............................................
© H ERIOT-WATT U NIVERSITY
7
Topic 2
Design
Contents
2.1 Multi level sites . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
2.1.1 Linear and hierarchical structures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
2.1.2 'Multi-level' navigation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
2.1.3 Navigation bar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
2.1.4 Navigational aids . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
2.2 End-user requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
2.2.1 Principles of User centred design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
2.2.2 Stages of User centred design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
2.2.3 Capturing user requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
2.2.4 User stories . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
2.2.5 User scenarios . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
2.2.6 Use case . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
2.3 User interface design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
2.3.1 Wireframing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
2.3.2 Low fidelity prototype . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
2.3.3 High fidelity prototype . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
2.4 Learning points . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
2.5 End of topic test . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
8 TOPIC 2. DESIGN
Prerequisites
From your studies at National 5 you should already know how to:
• describe and create a website structure with a home page, linked multimedia pages,
and external links;
• describe, exemplify and implement, taking into account end-user requirements, effective
user-interface design (visual layout and readability) using wireframing:
◦ navigational links;
◦ consistency across multiple pages;
◦ relative vertical positioning of the media displayed;
◦ file formats of the media (text, graphics, video, and audio);
• understand how the Copyright, Designs and Patents Act 1988 applies to web content
(text, graphics, video, and audio);
• compare a range of standard file formats:
◦ audio standard file formats WAV and MP3 in terms of compression, quality, and file
size;
◦ bit-mapped graphic standard file formats JPEG, GIF, and PNG in terms of
compression, animation, transparency, and colour depth;
• describe the factors affecting file size and quality, relating to resolution, colour depth,
and sampling rate;
• describe the need for compression;
• describe, exemplify and implement prototyping (low fidelity) from wireframe design at
this level.
Learning objective
• describe and develop the structure of a multi-level website with a home page and two
additional levels;
• create a website taking into account end-user requirements and device type, an
effective user-interface design (visual layout and readability) using wire-framing;
• create a prototype (low fidelity) web page from a wireframe design;
• design, describe and apply the key aspects of user-centred design including using
analysis tools to capture user requirements;
• develop user profiles, user personas, user stories, user scenarios and use cases;
• describe, explain and apply the development of user interfaces using prototypes (from
low to high fidelity including wireframes);
© H ERIOT-WATT U NIVERSITY
TOPIC 2. DESIGN 9
© H ERIOT-WATT U NIVERSITY
10 TOPIC 2. DESIGN
Linear and Hierarchical navigation structures are simplistic models of how pages can be organised
in a website. In reality, links between pages (and even external sites) can be much more complex.
A hierarchical structure may underlie the site, but in reality there will be many ways of navigating
through the content.
© H ERIOT-WATT U NIVERSITY
TOPIC 2. DESIGN 11
© H ERIOT-WATT U NIVERSITY
12 TOPIC 2. DESIGN
• History - A complete list of all nodes or links that have been visited. Each previous screen
is represented once in the history file. The user can return by simply clicking on the relevant
highlighted link. The history file will only contain recently visited links and will not contain older
links.
• Breadcrumbs - A 'trail' which has been left and can lead the user back to wherever they have
originated.
• Highlighting (nodes/links) - Clicking on hyperlinks to follow links to different screens. They
will change colour once they have been selected.
• Backtracking - Use of a back button which will link to the last screen visited.
• Bookmarks - A list of pages that have been selected and saved by the user so that they can
visit these pages again.
© H ERIOT-WATT U NIVERSITY
TOPIC 2. DESIGN 13
Q1: Explain the difference between a linear structure and a hierarchical structure. You may
include a diagram.
...............................................
Investigate a website you use frequently and create a navigational structure for it.
Some websites that you could use are:
• design, describe and apply the key aspects of user-centred design including using
analysis tools to capture user requirements;
• develop user profiles, user personas, user stories, user scenarios and use cases.
User-centred design (UCD) is a method that ensures that a program, product, app or website will be
easy to use. This approach to the design of a product focuses on the user: their needs, their wants,
and their limitations and these are considered at each and every stage of development.
User-centred design is a multi-stage problem solving process. At regular points during the
development of a product, designers must analyse and imagine how users are likely to use the
© H ERIOT-WATT U NIVERSITY
14 TOPIC 2. DESIGN
product. User-centred design also requires that designers carry out usability testing, with real world
users, to ensure that the product meets the needs of the users and functions in the way that users
would expect it to function.
This kind of testing is necessary as it is often very difficult for the designers of a product to
understand intuitively what a first-time user of their design experiences, and what each user's
learning curve may look like.
The key strength of user-centred design is that it focuses on how users can, want or need to use the
product rather than forcing the users to change their behaviour to accommodate the product.
1. The design is based upon an explicit understanding of users, tasks and environments.
This approach ensures that users are always considered during the development of the product.
The design is based upon an explicit understanding of users, tasks and environments
It is key that the design team understand how the intended users will use the product: the context of
use. To achieve this the design team need to consider the three main features of user experience.
To understand:
• the user;
• what the user wants to do with the product;
• understand the environment in which the product is used.
© H ERIOT-WATT U NIVERSITY
TOPIC 2. DESIGN 15
© H ERIOT-WATT U NIVERSITY
16 TOPIC 2. DESIGN
© H ERIOT-WATT U NIVERSITY
TOPIC 2. DESIGN 17
Now that the design team have a good understanding of the user, the tasks and the environment in
which the product will operate they can produce a full specification for the product. This specification
will include the documentation generated when developing an understanding of the "context of use"
but will also include performance and satisfaction criteria (measures of usability for the product)
and test methods (the means of determining whether the usability requirements have been met).
To ensure that the requirements are correct, other user centred design activities (such as
interviews, surveys, focus groups, field studies, task analysis, benchmark usability tests,
or paper prototyping) can be used early in the development process to obtain feedback from users
to iteratively refine requirements.
Produce design solutions
The production of the solution will generally start with simple wireframes such as initial pencil
sketches and move through formal wireframes to low-fidelity prototypes and then to high-fidelity
prototypes and then the fully implemented and functional solution.
© H ERIOT-WATT U NIVERSITY
18 TOPIC 2. DESIGN
Typically, at each iteration of the cycle, some complexity/refinement is added to the solution, based
on the updates to the requirements (as the result of the previous user testing).
Evaluate design against requirements
The evaluation of the solution is carried out against the requirements using a number of techniques.
Usability testing to determine if the requirements have been met is the focus of the testing and
this will be carried out using real users and real tasks (these are detailed in the User stories/User
scenarios and Use cases).
While the solution is in development the feedback from testing can be documented in a Prototyping
session report. This document records the results of the testing and includes recommendations to
make changes to the "Context of Use" documentation, to the performance and satisfaction criteria
or to the redefine the test methods.
© H ERIOT-WATT U NIVERSITY
TOPIC 2. DESIGN 19
and creates a level of awareness about the users that helps the design team. As people become
familiar with the personas, they start talking about them as if they were actual people.
Personas do not need to be complex to be useful. The design team can begin by creating brief
outlines of personas based on initial conversations with those involved in the project.
An example persona would be:
Activity: Personas
© H ERIOT-WATT U NIVERSITY
20 TOPIC 2. DESIGN
"As a busy lawyer, Nikki wants to arrange a quick lunchtime meeting with colleagues. She needs
quick access to restaurant information in the local area and a quick way to see which have tables
available because she is making arrangements between meetings."
Notice that the user story identifies who the user is, what she needs, and why she needs it.
Here's another example of a user story that might apply to the same restaurant finder app designed
to meet our first user's need:
"Jack is a single parent and is meeting his children after school. He wants to find a local family
friendly restaurant for a surprise birthday party for one of his children."
This second example maintains the same structure, but represents a very different user. A
restaurant finder app is likely to have a wide array of users with different needs, big and small.
User stories help to document the practical differences in need among those users.
For each user develop a small user story that defines what drives a user to make use of your
application.
"Jerry is a vegan and is arranging a night out with two friends: one is a vegetarian and the other
eats meat. Jerry finds it difficult to find restaurants that meet all their needs and, in the past,
nights out haven't been very good because there is often a problem with the food order. He has
tried searching online but, when he does find somewhere, frequently he rings them to find out
they have no tables available. He now has only one day left to make arrangements for the night
out and is getting worried. He still has to book a restaurant and then call his friends to make
arrangements to meet."
Notice how this scenario gives the user some backstory, gives some context about his needs, and
tries to specify the gaps in his knowledge that might lead to interaction difficulties.
© H ERIOT-WATT U NIVERSITY
TOPIC 2. DESIGN 21
Extend your user stories from the previous section, development them to become user
scenarios.
This detailed case highlights several points at which Jerry's experience could be improved. With this
case as a guide, improvements could be made the listing of the restaurants (so that only those with
availability are shown) and to the order of the list (so that it remembers how it was sorted when the
user returns to it). Use cases can be informed and/or verified by the results of usability testing.
For each user story that you have created, develop a Use case which details what each user
will do with the application.
© H ERIOT-WATT U NIVERSITY
22 TOPIC 2. DESIGN
• describe, explain and apply the development of user interfaces using prototypes (from
low to high fidelity including wireframes);
• describe how an application style guide is used to ensure a consistent look and feel to
an application;
• create an initial application style guide for an application.
The solutions designed as part of user-centred design, become increasingly more sophisticated as
the design team develop their solution and test it on users. Early versions of the solution may be
simple pencil drawings/wireframes. Towards the end of the development process the solutions will
be sophisticated computer based products that users can interact with fully.
These increasingly complex solutions are developed using a number of prototyping and design
methods.
© H ERIOT-WATT U NIVERSITY
TOPIC 2. DESIGN 23
2.3.1 Wireframing
A wireframe can start out as a simple pencil sketch of a user interface. The wireframe can be
developed from a low level of detail and functionality up to a high level of detail and functionality.
© H ERIOT-WATT U NIVERSITY
24 TOPIC 2. DESIGN
Visit Scholaria want to create a new website. The website will have a multi-level structure,
consisting of a home page with a horizontal navigation bar that gives clear links to four main
areas (pages). Each of the four main pages will have links to relevant sub-pages.
An example of the homepage can be seen here:
This diagram shows the navigational structure for the site. You should now create a set of
wireframe designs for the Visit Upper Scholaria site we looked at previously.
© H ERIOT-WATT U NIVERSITY
TOPIC 2. DESIGN 25
Create a wireframe for each of the 5 main pages (Homepage, Cathedral, Golf Club, Ski &
Mountain Resort and Coin Collectors Club).
Each wireframe should indicate the intended layout of the page and show the horizontal and
vertical position of:
• navigational bars;
• all text elements on the page;
• any media elements (images, audio clips and video clips);
• elements that allow the user to interact with the page;
• any form inputs;
• any hyperlinks on the page.
© H ERIOT-WATT U NIVERSITY
26 TOPIC 2. DESIGN
© H ERIOT-WATT U NIVERSITY
TOPIC 2. DESIGN 27
© H ERIOT-WATT U NIVERSITY
28 TOPIC 2. DESIGN
• describe and develop the structure of a multi-level website with a home page and two
additional levels;
• create a website taking into account end-user requirements and device type, an
effective user-interface design (visual layout and readability) using wireframing;
• create a prototype (low fidelity) web page from a wireframe design;
• design, describe and apply the key aspects of user-centred design including using
analysis tools to capture user requirements;
• develop user profiles, user personas, user stories, user scenarios and use cases;
• describe, explain and apply the development of user interfaces using prototypes (from
low to high fidelity including wireframes);
• create a wireframe design that can:
◦ show a horizontal navigational bar;
◦ plan the horizontal and vertical positioning of the media;
◦ indicate form inputs;
◦ indicate file formats of the media in a web page (text, graphics, video, and audio).
Q4: Designers use this technique to generate an outline design of the user interface of an
application/website:
a) persona
b) wireframe
c) pseudocode
d) use case
...............................................
a) version of the application drawn on paper with which users can interact.
b) sketch of the user interface which users can comment on.
c) pseudocode design.
d) template of buttons, menus, and text boxes that users can discuss.
© H ERIOT-WATT U NIVERSITY
29
Topic 3
Implementation: HTML
Contents
3.1 Revision . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
3.2 Semantic elements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
3.3 Form elements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
3.4 Learning points . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
3.5 End of topic test . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
30 TOPIC 3. IMPLEMENTATION: HTML
Prerequisites
From your studies at National 5 you should already know how to:
• create a basic HTML page structure using the Head, Title and Body tags;
• use the following HTML tags: heading (h1-h6); paragraph <p>; DIV, link; anchor <a>;
IMG; audio, video;
• create lists that are ordered and unordered and add list items to them;
• create Internal Hyperlinks between pages in a website and External Hyperlinks to pages
that are not a part of your website;
• use relative and absolute addressing in a website.
Learning objective
© H ERIOT-WATT U NIVERSITY
TOPIC 3. IMPLEMENTATION: HTML 31
3.1 Revision
Quiz: Revision Go online
a) a HTML tag.
b) a unique ID.
c) a class.
d) a paragraph.
...............................................
...............................................
Q3: Where would you find the title tag and what is its purpose?
...............................................
© H ERIOT-WATT U NIVERSITY
32 TOPIC 3. IMPLEMENTATION: HTML
Before getting started we want to keep things organised. Create a new folder called Web
Design and than create a new folder for this task called "Revising HTML and CSS".
1
2
3
4
5
6 ! " #
7 $ %& & ' %& ( # & ! %& ) &
8 #
9 *
10 %
11 + , - " # +
12 #
13 %& &
14 - %& - & %& - # . -) '-&
15 / # /
16 ' ! ' ( $' -- 0
* " +121 0 0$-
,3 4 ) #'
17 ' ' 0 * -'
5 5 5* 6 57 8 #'
18 #
19 %& " &
20 - %& - & %& - # "") '-&
21 / " # /
22 ' - ! ! 0* '-
* ! ) " 5 5 5*
6 57 8 "" ) 9 *0 '' ""
! 0 * * ' 0*
'- ) "" 0 ! ' -
' - 0* '- ) #'
23 ' "" ! - " " !
0 !! ! 0* '- *
' ) #'
24 #
25 % !
26 ' : ! $ 57 0*
! %& ' ;## 000 ) 07 ) - #& # #'
27 #
28 # *
29 #
Using a text editor, create a file using the text from the file above and save this file to your
"Revising HTML and CSS" folder as revising.html.
© H ERIOT-WATT U NIVERSITY
TOPIC 3. IMPLEMENTATION: HTML 33
Test it in your web browser and you should see the following:
Notice that the images have not been displayed yet, you can download and save them into
your website's folder:
© H ERIOT-WATT U NIVERSITY
34 TOPIC 3. IMPLEMENTATION: HTML
© H ERIOT-WATT U NIVERSITY
TOPIC 3. IMPLEMENTATION: HTML 35
In the head section of your index.html page add the following stylesheet rules:
1
2 #< 0 * 6 - 8
0*'-<#
3 * =
4 *$- ; - ->
5 ; '' >
6 ?
7 - =
8 - ;+@A '( >
9 ?
10 #< 0 * *B
'' 0*'-<#
11 C =
12 *$- ; - * >
13 - ; >
14 ?
15 C " =
16 *$- ; - * >
17 - ; >
18 ?
19 #< 0 * *B
'' 0*'-<#
20 ) =
21 *$- ; D >
22 ( - ; >
23 ?
24 ) ! =
25 *$- ; D >
26 ( - ; >
27 ?
28 #
© H ERIOT-WATT U NIVERSITY
36 TOPIC 3. IMPLEMENTATION: HTML
Take some time to review the rules that have been created. You may want to change some of
the rules to see what happens.
© H ERIOT-WATT U NIVERSITY
TOPIC 3. IMPLEMENTATION: HTML 37
At Higher level you will be expected to be able to produce webpages and sites that meet the
following requirements:
• web sites will use a horizontal navigation bar to allow users to access the different
pages;
• users will experience a consistent theme throughout with additional information to help
navigate a multi-level site;
• all videos and images display correctly and appropriately as designed (horizontally and
vertically);
• the page has been created with appropriate tags so the web browser can display it
correctly (i.e. header, title and a footer sections have been created using appropriate
semantic elements).
With previous versions of HTML developers created IDs and classes in order to style and control
different elements of their web page (i.e. id="nav", class=article). With the creation of HTML 5 the
W3C sought to streamline this and so semantic elements were created.
© H ERIOT-WATT U NIVERSITY
38 TOPIC 3. IMPLEMENTATION: HTML
• This will be used to access the main navigational links for your website, very often this will be
the same links on multiple pages.
• Not all links on a page have to be placed here.
Header - <header>
• Similar to a header in a word processing document the header tag in HTML is placed at the
top of webpages. It will typically contain the name and logo for the website.
Footer - <footer>
• Similar to a footer in a word processing document the footer tag in HTML is placed at the
bottom of webpages and is usually the last tag in the body of the webpage.
• It will typically contain a link back to the top of the page (anchor link), copyright information
and contact information.
Section - <section>
Main - <main>
• This tag is used to contain all the content that is unique to that page. Items such as navigation
links, headers and footers should be in their own section.
form - <form>
• This is used to create an area to get input from the website's user, this will be looked at in
more detail in the section on Form elements.
id attribute
• This should be used to uniquely identify elements in an HTML page. No other element in the
page should have the same ID. This allows the CSS and Javascript to correctly access and
manage the element.
You may find some others useful and you can see the full list here:
https://www.w3schools.com/htmL/html5_semantic_elements.asp
© H ERIOT-WATT U NIVERSITY
TOPIC 3. IMPLEMENTATION: HTML 39
1
2
3 " #
4 #
5 *
6
7 + " * # +
8 #
9
10
11 ! %& ( ) & # #
12 ! %& ) & # #
13 ! %& - ! *) & 4 ! * # #
14 ! %& $, ) & "$ , # #
15 ! %& *) & # #
16 #
17 #
18 " * ! *
19
20
21 ! %& -) & - # #
22 ! %& BE ) & F E # #
23 #
24 #
25
26 / 5 0 # /
27 ' " * -' !
) 5 "
- - #'
28 #
29 !
30 7 # 7
31 ' ! %& ; G) ) & E # #'
32 H ' > " /A+I
33 # !
34 # *
35 #
© H ERIOT-WATT U NIVERSITY
40 TOPIC 3. IMPLEMENTATION: HTML
You will notice that the page still looks very plain and 'linear' when viewed in a browser. That's
because HTML is only used to describe the structure and contents of the page. To change
the layout and looks of the page another supporting language called CSS - Cascading Style
Sheets - is needed. There is more about this language coming up in this unit.
Using a text editor and the coin collectors page from the previous practical task as a template,
create the 3 other web pages for the site:
• The Cathedral
• The Golf Club
• Mountain Ski Resort
Using the design we've looked at previously adapt the sub-navigation sections with links to
the pages given.
© H ERIOT-WATT U NIVERSITY
TOPIC 3. IMPLEMENTATION: HTML 41
The website should encourage visitors to explore the (fictitious!) region of Scholaria's best
landmarks and attractions.
You should include the following:
© H ERIOT-WATT U NIVERSITY
42 TOPIC 3. IMPLEMENTATION: HTML
Forms in web development are typically used to submit data for processing. A web form has two
parts: the HTML "front end" and a "back end" form processor. The front end operation occurs in the
client (the browser) and the back end processing occurs on the server side.
The interactions with a web form are typically:
4. The browser sends the submitted form data to the web server.
5. A form processor script running on the web server processes the form data.
In the following activity you will create a simple HTML form and perform client side validation of the
form.
Forms are created using the <form> HTML element. This element is used to open a collection of
form associated elements (the things that form is made up of) and the close tag </form> is used to
end the collection.
© H ERIOT-WATT U NIVERSITY
TOPIC 3. IMPLEMENTATION: HTML 43
Create the following HTML code and save in a file called signup form.html in the root folder
of your testing web server e.g. htdocs or httpdocs.
1
2
3
4 %& ! 2&
5 "- ' ! #
6 $ %& & %& & ! %& ) &
7 #
8 *
9 ! ! -'
10 ! %& -'.! & %& -'.! &
11 ! ! -
12 # !
13 # *
14 #
This simple HTML document contains a <meta> element to force it to use Unicode encoding, a
title for the document and a link to cascading style sheet that does not yet exist (we will create the
HTML elements first then add the CSS and JavaScript later). The <form> element has a number
of attributes:
The <input> element is used to create the text box using the text type.
< >
As is the convention, because the input element doesn't have a closing tag, we use /> to close it.
Common attributes used with the input element:
• type="text" specifies that the browser should display a single line text input box;
• name="firstname" means that when the form is submitted the contents of this input will be
referred to as firstname;
• value="Please enter" Value specifies a value to place in the text box when the form is created;
• maxlength="60" gives the text box a maximum number of characters that it can hold;
© H ERIOT-WATT U NIVERSITY
44 TOPIC 3. IMPLEMENTATION: HTML
• size="40" the size of the text box as it appears in the web page;
• placeholder="Jenny Smith" The placeholder attribute specifies a short hint that describes
the expected value of the input and displays this hint in the input area before the user enters a
value.
Add the following code to the signup form.html under the comment line
< >
1
2
3 / "- E' # /
4 ' %& D. ! & < ,D
: # '
5 #
6
7 * ! %& & E ; # *
8 ' %& & ' %& ( & %& & %&&
J %&IA&
9 ( - %&IA& ' %& B K/& #
10 #
11
12 * ! %& & , 3 ; # *
13 ' %& & ' %& ( & %& & %&&
J %&IA&
14 ( - %&IA& ' %& F " & #
15 #
16
17 * ! %& & ; # *
18 ' %& & ' %& & %& & %&&
J %&IA&
19 ( - %&LA& ' %& B ) G( ' ) &#
20 #
21 ! M - ' !
22 #
Hints can be added to the form to assist users when completing it. e.g.
© H ERIOT-WATT U NIVERSITY
TOPIC 3. IMPLEMENTATION: HTML 45
1
2 * ! %& & ; # *
3 ' ' %& ( & %& & %&& J %&IA& ( - %&LA&#
4 ' %& ! . & E ! & G ) & # '
5 #
Add suitable hints for the three single line text inputs in the form using the code
< > < > above.
Change the contents of the hint to be appropriate to each input.
To complete the form, we will add a small text area for multi-line text input, a check box to agree to
some terms and conditions and a submit button.
A multi line text area can be used to collect an extended about of text
Text area
that would occupy multiple lines.
• name="message" means that when the form is submitted the contents of this textarea will be
referred to as message;
• cols="40" Sets how wide the textarea will be in terms of number of characters;
• rows="6" Sets the number of visible lines of text in the text area.
The <button> element is used to create a button. Unlike the button which can be created with the
<input> element, the <button> element can hold content, like text or images.
<! ! ! >" <!>
Common attributes used with the button element:
• type="<value>" details the type of button. A value of button creates a "button" without a form
action which can be used with JavaScript and an OnClick function. A value of "reset" creates
a reset button that clears the values entered in the form. A value of "submit" creates a button
that sends the forms contents for processing.
© H ERIOT-WATT U NIVERSITY
46 TOPIC 3. IMPLEMENTATION: HTML
Amend the signup form.html file to include the following lines of code after the HTML
comment < #$ > and before the closing tag.
1
2 * ! %& -& -; # *
3 ( %& -& %& -& %&IA& 0 %&L&
# (
4 ' %& ! . & 9 *! - N 0 0 -
' ) # '
5 #
6
7 * ! %& .. & 9-
# *
8 ' %& .. & ' %& $*(&
%& .. &
9 #
10
11 * %& * & ' %& * & "* : # *
12 #
13 ! !
Preview the form in your web browser. The form will now appear as:
© H ERIOT-WATT U NIVERSITY
TOPIC 3. IMPLEMENTATION: HTML 47
Create a stylesheet file called styles.css and save this in the same location as your
signup form.html file. We will be looking at CSS in more detail in the next topic, so for now
enter the following rules into the file.
1 G & E: 2&>
2 #< "" <#
3 #< ! ! ! ' <#
4 * =
5 ! ; +I '( #/+ '( & " & N & 4 & N & "
E& N
6 ! >
7 ?
8
9 ) -'.! / N ) -'.! * =
10 ! ! ; 4- N N & 30 , & N ! >
11 ?
12 ) D. ! =
13 ! J ; ++ '( >
14 ?
15
16 ) ! . =
17 ! J ; ++ '( > - ; ' >
18 ?
19
20 #< ! 0 $ <#
21 <; ! =
22 ; >
23 ?
24
25 #< $ ! ! * !-
<#
26 ) -'.! =
27 0 ;1@A '( >
28 ' ; >
29 ' ; >
30 - ;A '( >
31 '-;A '( >
32 ?
33 ) -'.! =
34 '- ;+/ '( >
35 * * ;+ '( C >
36 ' ; >
37 ?
38
39 #< ' * ! ! <#
40 ) -'.! ; ! N ) -'.! ; =
41 * * ;+ '( CKKK>
42 ?
43
44 #< * ' & D& !
- <#
45 ) -'.! / =
46 - ;A>
© H ERIOT-WATT U NIVERSITY
48 TOPIC 3. IMPLEMENTATION: HTML
© H ERIOT-WATT U NIVERSITY
TOPIC 3. IMPLEMENTATION: HTML 49
This CSS code significantly enhances the visual appearance and behaviour of the form.
Finally, we can use the HTML5 required attribute to tell the browser that an input / textarea element
must have a value before the form can be submitted e.g.
1 ' ' %& ( & %& & %&& J %&IA& ( - %&IA&
2 ' %& B K/& D #
© H ERIOT-WATT U NIVERSITY
50 TOPIC 3. IMPLEMENTATION: HTML
Add the required attribute to the inputs for username, realname and email. Leave the
message textarea as an optional item.
Some additional styling can be added to these fields. These rules will add a red asterisk to the
background of each required field.
Download this image of a red asterisk and place it in a subfolder called "images" inside your
web folder. Name the downloaded file "red-asterisk.png" to match the CSS rule.
red-asterisk.png
For further reading you can find a complete list of HTML tags here:
https://www.w3schools.com/tags/
© H ERIOT-WATT U NIVERSITY
TOPIC 3. IMPLEMENTATION: HTML 51
© H ERIOT-WATT U NIVERSITY
52 TOPIC 3. IMPLEMENTATION: HTML
Q8: Which HTML element is used for creating the site navigation structure?
a) <nav>
b) <navigate>
c) <menu>
d) <div id-navigation>
...............................................
a) <top>
b) <head>
c) <header>
d) <section>
© H ERIOT-WATT U NIVERSITY
53
Topic 4
Implementation: CSS
Contents
4.1 Revision . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
4.2 CSS Priorities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
4.2.1 Web browsers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
4.2.2 Cascading Style Sheet (CSS) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
4.2.3 Internal stylesheet . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
4.2.4 In-line styles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
4.2.5 Review . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
4.3 Increasing efficiency in CSS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
4.3.1 Grouping selectors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
4.3.2 Descendant selectors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
4.4 Appearance and positioning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
4.4.1 Display . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
4.4.2 Float and clear . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
4.4.3 Margins and padding: The box model . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
4.4.4 Sizes (height and width) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
4.5 Navigation bars . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
4.6 Learning points . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
4.7 End of topic test . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
54 TOPIC 4. IMPLEMENTATION: CSS
Prerequisites
From your studies at National 5 you should already know how to:
• create a stylesheet:
◦ internal and;
◦ external;
• use selectors, classes and IDs in your stylesheet to control sections of your webpage;
• set the following text properties:
◦ Font
Font-family
Font-size
◦ Color
◦ Alignment
• set the background colour of different sections in a webpage using:
◦ Selectors (body, H1);
◦ Classes (.headingClass);
◦ IDs (#currentPage);
• create and link to a CSS document from a webpage;
• read and explain all of the above in terms of a Stylesheet / CSS document.
Learning objective
By the end of this topic you should be able to know how to efficiently use:
• inline styles, internal stylesheets and external Cascading Style Sheets (CSS);
• understand the order of priority given to each method of styling a web page;
• grouping selectors to increase efficiency of CSS and web pages;
• descendant selectors to increase efficiency of CSS and web pages;
• using the following properties and rules to control appearance and positioning of
elements in a web page:
◦ display (block, inline, none);
◦ float (left, right);
◦ clear (both);
◦ margins / padding;
◦ sizes (height, width);
• grouping and descendant selectors to create horizontal navigation bars;
© H ERIOT-WATT U NIVERSITY
TOPIC 4. IMPLEMENTATION: CSS 55
© H ERIOT-WATT U NIVERSITY
56 TOPIC 4. IMPLEMENTATION: CSS
4.1 Revision
We're now going to go back to our "Revising HTML and CSS" website that we were introduced to in
the Implementation: HTML topic and we will move our styles into a separate CSS document.
Using a text editor create a new file in your website folder called "stylesheet.css".
Enter the CSS below and save it as "stylesheet.css".
1 * =
2 *$- ; - ->
3 ; '' >
4 ?
5
6 - =
7 - ;+@A '( >
8 ?
9
10 C N C " =
11 *$- ; - * >
12 - ; >
13 ?
14
15 ) N ) ! =
16 *$- ; D >
17 ( - ; >
18 ?
19
20 ) - =
21 ! ; - >
22 ?
In your index file enter the following line in between the <head> tags:
Save both of these files and test that your website is displaying properly again with all style
rules working.
© H ERIOT-WATT U NIVERSITY
TOPIC 4. IMPLEMENTATION: CSS 57
pages.
This graphic shows the priorities that are applied when styling a web page.
• The layout of many documents or even an entire website can be controlled from one style
sheet, reducing the amount of code required for formatting.
• The developer gets a more precise control over layout than by using HTML tags.
• The developer can apply different layouts to different media types, screen or print etc.
• Several different stylesheets can be used to change the look of a site according to users'
preferences.
© H ERIOT-WATT U NIVERSITY
58 TOPIC 4. IMPLEMENTATION: CSS
Websites have to be able to be viewed on a variety of different devices and screen sizes and CSS
can help with this. CSS can create rules for different devices that have different screen widths so
that the website will display slightly differently on each device. This ensures that the user is always
viewing the website correctly.
If a style sheet is created for a web page then the programmer does not need to insert hundreds of
different tags for formatting. If the design is to be changed then it is only the style sheet that needs
to be changed - not the entire website.
Output:
Key point
In the example above the link to the stylesheet called "style.css" still exists but as the internal
stylesheet is given below it is executed after the CSS styles have been loaded and overrides
the CSS file.
© H ERIOT-WATT U NIVERSITY
TOPIC 4. IMPLEMENTATION: CSS 59
Final output:
Key point
As you can see from the above, even when the external stylesheet is linked and the internal
stylesheet is present the in-line style has again overruled both of these and used the individual
elements style.
© H ERIOT-WATT U NIVERSITY
60 TOPIC 4. IMPLEMENTATION: CSS
4.2.5 Review
When used effectively each of the methods of styling a web page has its merit. However, for ease of
maintaining a website having a separate document is preferable with items that are to be individually
altered given an ID to be directly targeted from a stylesheet. If necessary we can even use multiple
CSS files to style one page.
It may be easy to create an internal stylesheet to test the look and function of your webpage without
affecting other pages in the site before moving it into an external stylesheet.
• efficiently use grouping and descendant selectors in a web page to control appearance
and positioning using the following rules:
◦ display (block, inline, none);
◦ float (left, right);
◦ clear (both);
◦ margins / padding;
◦ sizes (height, width).
1 ' =
2 ; $ >
3 ?
4 = 1 'N N =
5 ; $ 2 ; $ >
6 ? 3 ?
7 =
8 ; $ >
9 ?
© H ERIOT-WATT U NIVERSITY
TOPIC 4. IMPLEMENTATION: CSS 61
1 / =
2 ; 0 >
3 ?
© H ERIOT-WATT U NIVERSITY
62 TOPIC 4. IMPLEMENTATION: CSS
To look at descendent selectors we are going to use a new website called "The Guid
Scottish Dog Walk".
Create a new folder for it and download https://courses.scholar.hw.ac.uk/vle/asset/Downloads/H-
CCMP/Course%20Downloads/4821994B-A624-D6AF-5024-308AB84CD322/TheGuidScottishDogWalk.zip
, extract the files and preview the homepage (index.html) in your web browser.
You should see this page displayed:
© H ERIOT-WATT U NIVERSITY
TOPIC 4. IMPLEMENTATION: CSS 63
Now create a CSS file called "style.css", save it in the same folder as the index.html file you
downloaded, and enter the following into it:
1 * =
2 *$- ; - $* >
3 ! ! ; ! >
4 ?
5 =
6 *$- ; - >
7 ! 0; >
8 ?
9 =
10 *$- ; -
11 ?
12 + =
13 ! ! ; " " >
14 ! J ; /I>
15 ( - ; >
16 ?
17 / =
18 ! ! ; " " >
19 ! J ; +I>
20 ?
21 ' =
22 ; $ >
23 ?
24 =
25 ; $
26 ?
27 =
28 ; $ >
29 ?
30 ) =
31 '- ! ; LA '( >
32 ?
Insert the link from the HTML page to the CSS in the head section by using the line below:
© H ERIOT-WATT U NIVERSITY
64 TOPIC 4. IMPLEMENTATION: CSS
Make sure you read both the HTML and CSS to make sure you understand what each part is
doing to display the webpage.
© H ERIOT-WATT U NIVERSITY
TOPIC 4. IMPLEMENTATION: CSS 65
• display properties;
• image attributes;
• margins and padding;
• defined size properties.
4.4.1 Display
There are many properties that can be applied to the display rule however the three we will focus on
are:
• Block
Many elements in HTML have the display block rule applied by default (doesn't need to be
specified in the CSS). It displays an element on its own as a block element. It starts on a new
line, and takes up the whole width of the page.
• Inline
Displays an element as an inline element. Any height and width properties will have no effect.
This will be used later on to help create a horizontal navigation bar.
• None
The element is hidden on the page, most commonly used in pages with Javascript.
You can find out more about the display property from the W3Schools website here:
https://www.w3schools.com/cssref/pr_class_display.asp
For this to work properly we need to place the image tag above the text we want to wrap
around it.
The clear property helps us control what elements can float around the current element.
© H ERIOT-WATT U NIVERSITY
66 TOPIC 4. IMPLEMENTATION: CSS
Example : Float
Now apply the following property to the image selector (img) from "The Guid Scottish Dog
Walk" by adding the following to our CSS file:
1 -=
2 ! ; >
3 ?
Once we've entered this rule we can try out the other options for float (left, right and inherit)
and we would see the following outcomes:
% (default) %
© H ERIOT-WATT U NIVERSITY
TOPIC 4. IMPLEMENTATION: CSS 67
Margins and padding can be specified in 2 ways, using individual CSS rules for top, left, right and
bottom or a shorthand rule that can specify all 4 in one line.
For example, if we want to have all the <div> elements in a page have a margin of 5 pixels all
around the element and a padding of 10 pixels between the margin and the content we would can
create the following CSS rules.
Examples
1. Individual rules
1 =
2 #< - <#
3 - ' ; @ '( >
4 - - ; @ '( >
5 - * ; @ '( >
6 - ! ; @ '( >
7
8 #< - <#
9 - '; +A '( >
10 - - ; +A '( >
11 - * ; +A '( >
12 - ! ; +A '( >
13 ?
...............................................
© H ERIOT-WATT U NIVERSITY
68 TOPIC 4. IMPLEMENTATION: CSS
2. Shorthand rules 1
1 =
2 - ; @ '( @ '( @ '( @ '( >
3 '-; @ '( @ '( @ '( @ '( >
4 ?
...............................................
3. Shorthand rules 2
1 =
2 - ; @ '( >
3 '-; +A '( >
4 ?
All three of the above CSS rules accomplish the same thing but the most efficient is example 3 as it
accomplishes the objective in the least number of lines.
If, however, we have different dimensions then learning to use example 2 will be the most efficient
and the example below we'll look at how the version of example 2 is structured:
Here is another example of how this can be implemented using different dimensions:
© H ERIOT-WATT U NIVERSITY
TOPIC 4. IMPLEMENTATION: CSS 69
Use the following html to make a page with a <header> and 2 <div> elements.
HTML
1
2
3
4 - - #
5 $ %& & ! %& ) &
6 #
7
8 *
9
10 + - - # +
11 #
12
13
14 % !
15 / "" - # /
16 ' "" - '' '
N ! ! *) #'
17
18 ' 5 "" N ! -)
'' ! - - !
19 ! 6 ' N - N * N
! 8 ) #'
20 #
21 % !
22 / "" - # /
23 ' "" '- '' - '
N ! !
*) #'
24
25 ' 5 "" N ! '-)
'' ! - '- ! !
26 6 ' N - N * N ! 8 ) #'
27 #
28 #
29 # *
30 #
© H ERIOT-WATT U NIVERSITY
70 TOPIC 4. IMPLEMENTATION: CSS
CSS: You will need to add the missing properties and rules.
1 * =
2 *$- ; - * >
3 ?
4 =
5 *$- ; * >
6 #< - ! / '( <#
7 - ; / '( >
8 ?
9 ) ! =
10 *$- ; * >
11 #< 9 - ! +A ! <#
12
13 #< 9 '- ! @ '( ! ' *
14 +A '( ! ! - ! <#
15
16 ?
17 /=
18 #< 9 - ! @ '( ! / - <#
19 ?
Follow the instructions in the CSS page to add margins and padding to the webpage.
• Pixels (px)
• Percentage (%)
• Centimetres (cm)
Using the Margins and Padding example webpage you've created previously set the width of the
definition class to be 40% and the height to auto (this should allow you to resize the window and still
© H ERIOT-WATT U NIVERSITY
TOPIC 4. IMPLEMENTATION: CSS 71
By the end of this topic you should be able to know how to efficiently use:
• create a navigation structure using hyperlinks for your website using the <nav></nav>
tags;
• remove the bullet points by altering the style of an unordered list::
◦ list-style-type:none;
• efficiently use grouping and descendant selectors to create horizontal navigation bars
using the following rules:
◦ list-style-type:none;
◦ hover.
In the Implementation: HTML topic we looked at the new semantic elements created for HTML 5,
we will be using the nav element <nav> to help us create a horizontal navigation bar.
© H ERIOT-WATT U NIVERSITY
72 TOPIC 4. IMPLEMENTATION: CSS
© H ERIOT-WATT U NIVERSITY
TOPIC 4. IMPLEMENTATION: CSS 73
CSS - style.css
1 * =
2 *$- ; >
3 ! ! ; ! >
4 ?
5 =
6 *$- ; 0 >
7 - ; +A '( >
8 ?
9 + =
10 ! J ; 7/ '( >
11 - ; A '( A '( A '( A '( >
12 '-; @ '(
13 ?
14 #< 9 -' * * + / 0
- '-) <#
15 + N /=
16 - ; A '( A '( A '( A '( >
17 '-; @ '(
18 ?
19 '=
20 - ; A '( A '( A '( A '( >
21 '-; @ '( >
22 ?
23 C - =
24 ! ; ! >
25 '- - ;/ '(
26 ?
27 =
28 '-; +A '( >
29 *$- ; 0 >
30 - ; +A '( >
31 ?
Take some time to look through both the HTML and CSS to make sure you understand what
is going on. If you are unsure or need some help speak to your tutor.
Create a new folder called images (inside your website folder).
Download https://courses.scholar.hw.ac.uk/vle/asset/Downloads/H-
CCMP/Course%20Downloads/17D2E11E-E6B0-8BB4-1CAA-BBC6742FA762/ScholariaCircus.zip
, extract the images and save them to the new folder you created.
© H ERIOT-WATT U NIVERSITY
74 TOPIC 4. IMPLEMENTATION: CSS
Circus 1 Circus 2
Preview your page in your browser and you should now see the following:
© H ERIOT-WATT U NIVERSITY
TOPIC 4. IMPLEMENTATION: CSS 75
© H ERIOT-WATT U NIVERSITY
76 TOPIC 4. IMPLEMENTATION: CSS
You should now see that your navigation bar has become a horizontal list as seen in the
example below:
Using hover
Finally we're going to use the hover selector to highlight one of the links in our navigation bar
if the user moves their mouse over it.
You may have seen this kind of functionality in when looking at JavaScript in the National 5
course however it can be implemented in CSS by using the descendant selector.
In your CSS file add the following selector and rule:
1 ; =
2 *$- ; 0 >
3 ?
© H ERIOT-WATT U NIVERSITY
TOPIC 4. IMPLEMENTATION: CSS 77
Save your CSS file, reload your web page and now hover over the hyperlinks in your menu
and you'll see they change colour as with the example here:
You may wish to learn more about the selectors in CSS and how they can add extra functionality to
your website there is a full list available on W3Schools which can be accessed here:
https://www.w3schools.com/cssref/css_selectors.asp
© H ERIOT-WATT U NIVERSITY
78 TOPIC 4. IMPLEMENTATION: CSS
• inline styles, internal stylesheets and external Cascading Style Sheets (CSS);
• understand the order of priority given to each method of styling a web page;
• grouping selectors to increase efficiency of CSS and web pages;
• descendant selectors to increase efficiency of CSS and web pages;
• using the following properties and rules to control appearance and positioning of
elements in a web page:
◦ display (block, inline, none);
◦ float (left, right);
◦ clear (both);
◦ margins / padding;
◦ sizes (height, width);
• grouping and descendant selectors to create horizontal navigation bars;
• use the following properties and rules when creating a horizontal navigation bar:
◦ list-style-type:none;
◦ hover;
• read and explain code that makes use of the above CSS.
© H ERIOT-WATT U NIVERSITY
TOPIC 4. IMPLEMENTATION: CSS 79
a) True
b) False
...............................................
...............................................
a) .active
b) #active
c) active
d) *active
...............................................
© H ERIOT-WATT U NIVERSITY
81
Topic 5
Implementation: JavaScript
Contents
5.1 JavaScript . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83
5.2 HTML Document Object Model (DOM) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86
5.2.1 What is the DOM? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
5.2.2 What is the HTML DOM? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
5.3 JavaScript Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
5.4 Three Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
5.5 Learning points . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96
5.6 End of topic test . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96
82 TOPIC 5. IMPLEMENTATION: JAVASCRIPT
Prerequisites
From your studies at National 5 you should already know how to:
Learning objective
By the end of this topic you should be able to know how to efficiently use:
© H ERIOT-WATT U NIVERSITY
TOPIC 5. IMPLEMENTATION: JAVASCRIPT 83
5.1 JavaScript
JavaScript is the default scripting language used in web development. This allows us to use the
<script> tags in our HTML document to store our JavaScript code.
JavaScript can be used to add extra functionality or interactivity to a webpage. JavaScript can offer
all the functionality of a programming language but must be run inside a web browser.
Similar to CSS rules we use JavaScript code directly inside the HTML tag, as a script within our
HTML file or store it in an external file (.js) that is linked to from our HTML document.
Download https://courses.scholar.hw.ac.uk/vle/asset/Downloads/H-CCMP/Course%20Downloads/67FF6DFA-
0A4A-3F50-4A60-FBFA30429E30/CodePositioning.zip , extract the files and preview in your Web
Browser.
This page uses the three different ways of storing JavaScript code.
HTML
1
2
3
4 %& ! 2&
5 %& 0' & %& 0 % 0 N %+&
6 5 ' F "' #
7 $ %& & ! %& "" # ) &
8 #
9 *
10
11 + M N M "' ( "' # +
12 ' * 0 ) #'
13 #
14
15
16 *
17
18 ' '-' * 0 F "'
H >'H - > - #'
19 ' %& ) ) % * >
) ) *$-% - - >&
20 %& ) ) % * $ >
) ) *$-% - >&
21 E 5* '- N F "' & &
'- - --) #'
22 #
23
24 ' '-' * 0 F "' !
H > ' H - > - #'
25 ' %& * ( 6 8& %& * $( 6 8 &
26 F "' ' N '
( N 0 5* *0) #'
27 #
28
29 ' '-' * 0 F "' !
( F "' !
- & ' ) B & # - #'
30 ' %& ( ( 6 8&
%& ( $( 6 8&
© H ERIOT-WATT U NIVERSITY
84 TOPIC 5. IMPLEMENTATION: JAVASCRIPT
JavaScript
1 ! ( ( 6 8 =
2 ) ) % & * &>
3 ) ) *$-% - - >
4 ?
5 ! ( $( 6 8 =
6 ) ) % & * $ &>
7 ) ) *$-% - >
8 ?
Key point
There is no rule as to where to put any JavaScript (or link to external JavaScript file) used in
your webpage. Some developers will place it in the head section, some will have it stored in
the page where it will be used and others will put it at the end of the file (within the body tags).
In most of the examples seen here the JavaScript or link to the script will be placed at the
end of the document, this will ensure that all of the page to be displayed is loaded before any
JavaScript code is executed.
A mark-up language can be called the language of the web and is used to create web pages. HTML
stands for Hypertext Mark-up Language. HTML uses pairs of tags, which a browser interprets to
know how to display a web page. Importantly, markup languages only contain information about
the content of the page. They do not offer the sort of constructs found in programming languages,
for example: data structures like variables; repetition with loops; selection using IF statements;
arithmetical and logical operations. This is where a scripting language like JavaScript can be useful.
Javascript can be used for a number of tasks in a web page:
• To create a more active page than regular HTML (things happen based on user interaction)
• To validate input on forms (check someone has entered all the required fields)
© H ERIOT-WATT U NIVERSITY
TOPIC 5. IMPLEMENTATION: JAVASCRIPT 85
JavaScript is called a client-side scripting language because the program is run by the 'client' -
your browser. This saves the web server having to do all the processing, which reduces the overall
demand on it. It can also make web pages quicker to respond: for example if you validate a form in
the browser with JavaScript, you don't need to transmit the information back from the server to find
out if it's correct or not.
There are also server-side scripting languages. As you might have worked out, they need to
be run by the server, and send the finished results to you. This is useful as they can interact with
databases of information based on the web server, generating database-driven HTML code on the
server and sending finished HTML page to your browser.
1. Request sent
© H ERIOT-WATT U NIVERSITY
86 TOPIC 5. IMPLEMENTATION: JAVASCRIPT
Client-side scripting and server-side scripting are two different ways to customise web pages and
allow scripts to run. A script is a set of instructions for a web page and they provide a change to
the way that a web page is displayed. Any page that changes every time you visit it will probably
be using scripts. Logging into a website or selecting from a menu uses scripts. You will learn more
about client-side scripting and server-side scripting in the rest of this topic.
Q4: Give three examples of what a scripting language can be used for in a web page.
In this image you can see a tree like structure that details all the elements stored in a web page.
© H ERIOT-WATT U NIVERSITY
TOPIC 5. IMPLEMENTATION: JAVASCRIPT 87
1. onmouseout
This function detects when the user's mouse pointer moves over a selected HTML element.
2. onmouseover
This function detects when the user's mouse pointer moves away from a selected HTML
element.
3. onclick
This function is triggered when a user clicks their mouse button when the mouse pointer is
over the selected HTML element.
These functions are triggered by the website user interacting with HTML elements that have
JavaScript functions listed inside its tag.
© H ERIOT-WATT U NIVERSITY
88 TOPIC 5. IMPLEMENTATION: JAVASCRIPT
Test your webpage in a web browser and check that both functions work.
Now apply the existing onmouseover and onmouseout events to the two paragraphs in the
page by adding this code to each <p> tag.
Save your page and test that these now work and change the colour of each paragraph.
Extension 1
Create two new functions to use different colours and styles for the two paragraphs when
the onmouseover event is triggered and have the text return to normal when the onmouseout
event is triggered.
© H ERIOT-WATT U NIVERSITY
TOPIC 5. IMPLEMENTATION: JAVASCRIPT 89
Extension 2
Using your text editor take the code from within your script tags and save it into a new file,
save it as "scripts.js".
Replace your scripts tags above with the following line:
Now test your page is loading the scripts and that your functions all still work.
Activity: onclick
Create a new html file in your text editor and enter this code:
1
2
3 F "' $ : ( ' #
4 #
5
6 *
7
8 + * * 0 ! '
- # +
9 #
10
11 * ' %& * & $%& -68 & $ # *
12 #
13 # *
14 '
15 ! -68
16 =
17 6& ! *- &8 >
18 ?
19 # '
20 #
© H ERIOT-WATT U NIVERSITY
90 TOPIC 5. IMPLEMENTATION: JAVASCRIPT
• <p>
• <span>
© H ERIOT-WATT U NIVERSITY
TOPIC 5. IMPLEMENTATION: JAVASCRIPT 91
Download https://courses.scholar.hw.ac.uk/vle/asset/Downloads/H-
CCMP/Course%20Downloads/4DA6D916-EC05-4A55-3347-EE2BB0203A61/ThreeFunctions.zip
, extract the files and preview in your web browser, you should see this page:
Try out the onmouseover and onmouseout functions by moving your mouse over each of the
first two <div> blocks and note when the text underneath the function name changes to a
number that will:
• count how many times you either moved your mouse over the element (<div>, <p> or
<span>) or;
• count how many times the mouse pointer moves away from the element.
The third element will count how many times the user clicks their mouse button when the
mouse pointer is over the element.
You're going to create a website for the "The Scottish Mental Health Society".
They want a new website created to help young children understand their basic emotions
(happy, excited, scared. . . ). They want the user to be able to click a button and get a definition
and see a picture of the matching emotion.
Download https://courses.scholar.hw.ac.uk/vle/asset/Downloads/H-
CCMP/Course%20Downloads/F9DF729C-3CE0-6C4A-88E3-C18887A5FC38/TheScottishMentalHealthSoc
, extract the files and preview in your Web Browser.
© H ERIOT-WATT U NIVERSITY
92 TOPIC 5. IMPLEMENTATION: JAVASCRIPT
You should now have the following inside of an HTML and CSS file along with associated
images.
HTML
1
2 F "' $ !
3 M ( ' 0 0 $ 0 0 $
! 0 ( - '- *
0- - )
4
5
6 %& ! 2&
7 %& 0' & %& 0 % 0 N
%+)A&
8 #
9 $ %& & ! %& "" # ) &
10 #
11 *
12
13 - % ! - %& - # ) '- & #
14 + # +
15 #
16
17 %& &
18 %& - &
19 - %& M -& %&& %& - # B ) '-&
20 #
21 %& (' &
22 / %& -& 4 $0 # /
23 ' %& (' & 9 (' ! 0
'' #'
24 #
25 #
26 %& ( &
27 %& - &
28 - %& M -& %&& %& - # ( ) '- &
29 #
30 %& (' &
31 / %& -& ( # /
32 ' %& (' & : - '' #'
33 #
34 #
35 %& '' &
36 %& - &
37 - %& M -& %&& %& - # '' ) '-&
38 #
39 %& (' &
40 / %& -& '' # /
41 ' %& (' & - N ' N - N
' - #'
42 #
43 #
44 %& &
45 %& - &
© H ERIOT-WATT U NIVERSITY
TOPIC 5. IMPLEMENTATION: JAVASCRIPT 93
CSS
1 * =
2 *$- ; $ >
3 ; 5 >
4 ! ! ; ! >
5 ?
6 - =
7 ( 0 ; 7AA '( >
8 * ; + '( * $ >
9 - - ; +A '( >
10 ( - ; /AA '( >
11 '-; +A '( >
12 ?
13 =
14 - ; /@A '( >
15 ?
16
17 C - =
18 ! ; ! >
19 ?
© H ERIOT-WATT U NIVERSITY
94 TOPIC 5. IMPLEMENTATION: JAVASCRIPT
20 C * =
21 ; * >
22 ( - ; >
23 ?
24 C =
25 ' ; * $ >
26 ?
27 C ( N
28 C '' N
29 C =
30 ' ; >
31 ?
32
33 ! =
34 ( - ; >
35 ?
36 ) ! -=
37 - ;+AAA '( >
38 ! ; - >
39 * ; >
40 ?
41
42 #< "" * 0 * <#
43 * =
44 *$-; C !!!!AA >
45 * ; @ '( >
46 '-; 2 '( /A '( >
47 ! ; KAA /I '( #+ ! >
48 ( - ; >
49 ?
Preview the page in your web browser and you should see this webpage:
© H ERIOT-WATT U NIVERSITY
TOPIC 5. IMPLEMENTATION: JAVASCRIPT 95
While the functions have already been referenced by each of the buttons the code does not
yet exist so none of the buttons currently work.
Insert the following code into your web page JavaScript section (or create an external .js file):
1 #< 3 ! "" ' '' !
- )
2 M! * ' * $ ! *
<#
3
4 ! ' " 68 =
5 ) - M 6& &8 ) ) ' % & * $ &>
6 ) - M 6& '' &8 ) ) ' % & &>
7 ) - M 6& ( &8 ) ) ' % & &>
8 ) - M 6& &8 ) ) ' % & &>
9 ?
10
11 ! ' '' 68 =
12 ) - M 6& &8 ) ) ' % & &>
13 ) - M 6& '' &8 ) ) ' % & * $ &>
14 #< ' ! ! <#
15 ?
16
17 ! ' ( 68 =
18 #< ' ! ! <#
19 ?
20
21 ! ' " 68 =
22 #< ' ! ! <#
23 ?
Now test the site again in your web browser and two button (Happy and Reset) will work
correctly however, you will need to complete the JavaScript code for the three unfinished
functions:
• displayHappy()
• displayExcited()
• displayScared()
© H ERIOT-WATT U NIVERSITY
96 TOPIC 5. IMPLEMENTATION: JAVASCRIPT
a) function myFunction()
b) function = myFunction()
c) function:myFunction()
...............................................
a) call myFunction()
b) myFunction()
c) call function myFunction()
...............................................
Q7: Which event occurs when the user clicks on an HTML element?
a) onmouseclick
b) onmouseover
c) onclick
d) onchange
...............................................
Q8: Which event occurs when the user's mousepointer leaves an HTML element?
a) onmouseclick
b) onmouseover
c) onclick
d) onchange
...............................................
© H ERIOT-WATT U NIVERSITY
TOPIC 5. IMPLEMENTATION: JAVASCRIPT 97
© H ERIOT-WATT U NIVERSITY
99
Topic 6
Contents
6.1 Usability testing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101
6.2 Usability testing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101
6.2.1 Usability testing techniques . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102
6.3 Functional testing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102
6.3.1 Input validation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103
6.3.2 Site validation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105
6.3.3 Page content (media) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107
6.4 Compatibility . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109
6.5 Fitness for purpose . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111
6.6 Usability . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111
6.6.1 Usability tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113
6.7 Learning points . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114
6.8 End of topic test . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114
100 TOPIC 6. TESTING AND EVALUATION
Prerequisites
From your studies at National 5 you should already know how to:
• that all:
◦ webpages should match the user-interface design;
◦ links (internal and External) and navigation work correctly;
◦ media in the page displays correctly (text, graphics, and video);
◦ pages in a site have a consistent theme;
• how webpages can be evaluated as being fit for purpose.
Learning objective
© H ERIOT-WATT U NIVERSITY
TOPIC 6. TESTING AND EVALUATION 101
1. Analysis
2. Design
3. Implementation
4. Testing
5. Documentation
6. Evaluation
7. Maintenance
You may already know from studying the Software Design and Development unit at National 5 that
after the implementation stage of the software development process comes testing. All stages of
the software development process are important but testing is essential to ensure that a project has
been completed to the highest standard possible. Errors can be detected at the testing stage and
fixed before the project is published, or handed over to the client.
You may also have heard of different types of methodologies such as rapid application development
or agile programming. Here, testing is also important but may be organized differently. Much of the
testing will be done in small parts during implementation, with larger-scale beta testing coming near
the completion.
At National 5 you will have learnt that a website should be tested to ensure that all the hyperlinks
work as expected, that there are no spelling or grammar errors, that pictures display correctly and
that any other features, such as a JavaScript application work correctly.
This type of testing is usually performed by the same team that created the website. This is
sometimes called 'in-house testing' or alpha testing. Some developers may involve the client at
this stage, though this is not strictly necessary.
© H ERIOT-WATT U NIVERSITY
102 TOPIC 6. TESTING AND EVALUATION
• Personas;
• test cases;
• low-fidelity protoypes.
Personas
At the testing stage the development team will revisit the personas that were previously created in
the design stage and have testers take on this persona when testing the website. They will then
use this to ensure that the goals created and the frustrations for each of the personas have all been
addressed.
Test cases
A list of tests would be created from the initial user requirements, testers will work through this
list to ensure all features and functions the clients have requested have been created and work as
expected.
Low Fidelity prototypes
We have already looked at scenarios based on what Low Fidelity Prototypes are in the 'Design'
topic, in the section 'User interface design: Low fidelity prototype'. Testers would now be asked to
interact with the prototype to perform regular functions the site would need to be able to handle.
Their actions would be watched and observations noted to help improve the site.
© H ERIOT-WATT U NIVERSITY
TOPIC 6. TESTING AND EVALUATION 103
Learning objective
Validation is the key to protecting against code injection and cross-site scripting attacks. By
validating the form data, we can protect against these exploits.
Client side validation techniques
Any validation carried out on the client site, using either JavaScript or another client technology, can
be subverted. There are tools, such as interception proxy servers, that intercept the data between
the client and the server and allow the hacker to change the requests before they can be sent
effectively rendering all client side validation for the purpose of security useless.
However, for the typical user, carrying out some kind of client side validation is useful as it can catch
errors before data is sent to the server.
We're now going to go back to the sign up form in the section on Form Elements that we
created in the topic Implementation: HTML.
HTML5 carries out validation based on the type attributes of form collection elements. There
is no specific markup required in order to activate form validation - it is on by default.
The first field, username, is text and is required. The web browser will validate the field so
that it must not be empty and contains characters. As long as the user entered al least one
character the field it will validate.
We can use the :valid and :invalid CSS selectors to format valid and invalid fields providing
visual information to the user.
Download each of these files and place them in your images folder.
valid.png
invalid.png
© H ERIOT-WATT U NIVERSITY
104 TOPIC 6. TESTING AND EVALUATION
Load the form and fill out the values to see how the use of the :valid and :invalid selectors
affects the form.
Further validation can be performed using the HTML5 pattern attribute. The username must be a
combination of only letters and numbers; no special characters or spaces are allowed.
To complete the formatting of the form add the following CSS rules to your styles.css file.
) ! . =
1
2 *$-; C I@/@/ >
3 * ; 7 '( 7 '( 7 '( 7 '( >
4 ; 0 >
5 - ! ;2 '( >
6 '-; + '( L '( >
7 J ( ; 111> #< * <#
8 ' ; * > #< 0 '' ! - ! 0
<#
9 ' ; >
10 ?
11
12 ) ! . ;; *! =
13 ; &S/@ A &> #< ! ' - ' <#
14 ;C I@/@/ >
15 ' ; * >
16 ' ;+ '( >
17 ! ; L '( >
18 ?
19
20 ) -'.! ' ; ! R ) ! . = ' ; >?
21
22 #< - ! 0 <#
23 ) -'.! ' ; D; R ) ! . = *$-;
C/21/+ ! >?
24
25
26 #< - ! 0 0 <#
27 ) -'.! ' ; D; R ) ! . ;; *!
= ;C/21/+! >?
© H ERIOT-WATT U NIVERSITY
TOPIC 6. TESTING AND EVALUATION 105
This CSS formats the hints so they are only shown when editing a field.
HTML5 can be used to carry out validation on the client side however every input must be validated
on the server side and made suitable for use.
• navigational bar links all work and link to the correct page;
• all external links work;
• all pages link back to the home page;
• internal links between pages work correctly;
• for orphan pages.
It may be useful to create a test table similar to one you would use in software development. An
example format is given here:
Area of
Internal / Result
webpage URL being Expected Actual Date Actions
External (Pass /
being tested Outcome Outcome tested required
link Fail)
tested
Navigation
Bar
<nav>
Body of
webpage
<body>
Footer of
webpage
<footer>
© H ERIOT-WATT U NIVERSITY
106 TOPIC 6. TESTING AND EVALUATION
Internal
Area of Result
URL being / Expected Actual Date Actions
webpage (Pass
tested External Outcome Outcome tested required
being tested / Fail)
link
Page
Navigation Homepage of
Index.html Internal loads Pass 31/07 None
Bar <nav> the site loads
correctly
Web page Page
Cast.html Internal with cast list loads Pass 31/07 None
loads correctly
Web page
Page Check <a>
with show
Show.html Internal does not Fail 31/07 tag and that
information
load page exists
loads
Web page Page
Gallery.html Internal with photo loads Pass 31/07 None
gallery loads correctly
Internal
Area of Result
URL being / Expected Actual Date Actions
webpage (Pass
tested External Outcome Outcome tested required
being tested / Fail)
link
Web page Check url
load in new and <a> tag
Body of
circusbookings. browser tab No page are correct.
webpage External Fail 31/07
co.uk to allow loads Check
<body>
purchase of external site
tickets is working.
Footer of Webpage Check <a>
No page
WebPage Contact.html Internal with contact Fail 31/07 tag and that
loads
<footer> form for users page exists.
© H ERIOT-WATT U NIVERSITY
TOPIC 6. TESTING AND EVALUATION 107
Create a navigation testing table for the homepage (index.html) of the "Visit Scholaria"
website.
Website: Webpage:
Area of
URL Internal / Result
webpage Expected Actual Date Actions
being External (Pass /
being Outcome Outcome tested required
tested link Fail)
tested
Navigation
Bar
<nav>
Body of
webpage
<body>
Footer of
webpage
<footer>
© H ERIOT-WATT U NIVERSITY
108 TOPIC 6. TESTING AND EVALUATION
Again when testing our web pages it is useful to create a table like the one used below to test the
Circus website we looked at previously.
Website: Scholaria Circus Webpage: index.html
Result
Media / Styles / Date
Expected Outcome (Pass / Actions required
Javascipt function tested
Fail)
Check all elements have
All planned text appearing
been used correctly.
Text in page and in correct Fail 01/08
Check to display property
location.
has been set to none.
Image of a circus tent to
Graphics Pass 01/08
appear in header of page.
Check image is in correct
Big image of the circus to
folder
appear in main section of Fail 01/08
Check <img> tag in HTML
the page.
document is correct.
Videos None N/A N/A None
Header - yellow
CSS Styles Pass 01/08
background
Navigation bar displayed
Pass 01/08
inline
Hover over link colour Pass 01/08
JavaScript None N/A N/A None
Create a testing table for the "Emotions" website created in the 'Implementation: JavaScript'
topic.
A blank table has been provided as a starting point, you can adapt it to suit the page you are
testing.
Website: Webpage:
Media / Styles /
Expected Result (Pass /
Javascipt Date tested Actions required
Outcome Fail)
function
© H ERIOT-WATT U NIVERSITY
TOPIC 6. TESTING AND EVALUATION 109
6.4 Compatibility
Learning objective
• understand and perform compatibility testing to ensure that websites display properly
on a variety of different devices:
◦ tablet;
◦ smartphone;
◦ desktop;
• understand the importance and perform compatibility testing to ensure that websites
display properly on a variety of different software:
◦ operating systems;
◦ web browsers.
Users now view information systems on a variety of different devices, often via websites - desktops,
laptops, notebooks, tablets and smartphones. Whilst all of these devices are able to display web
pages they are still very different and have different features. For example, a smartphone has
different input devices to a laptop, a different operating system, a smaller memory, smaller amount
of RAM, smaller cache and a slower processor. This means that not all devices can display the
same version of a website. Even on the same type of computer, different browsers can render page
elements differently, and use different technologies.
You will find that the different types of devices all have different specifications. When you compare
the more traditional devices, desktops and laptops, with the more current devices, tablets and
smartphones, you will find that tablets and smartphones have less memory and processing power,
and use different operating systems and input devices.
If you have used a smartphone before you may have found that when you try to view a web page
you are directed to an app, or the smartphone version of the website. This is because the 'normal'
version of the website cannot display on the smartphone for several possible reasons. Perhaps the
screen size is too small? Is there enough space in main memory? Is there bandwidth constraints or
© H ERIOT-WATT U NIVERSITY
110 TOPIC 6. TESTING AND EVALUATION
is it costly to use mobile data? Is it compatible with the mobile browser? Is the processor powerful
enough?
When you are creating a website it is important to think about who is going to use the website
and what type of device they are going to use. You might find that it is necessary to create different
versions of the same website that are suitable for different devices. If your website cannot be viewed
from a smartphone or a tablet then you are limiting the number of potential users and customers
that you will receive.
Obviously, maintaining different versions of the same website would be inefficient, so there has
been a gradual move towards 'responsive web design'. This means that one website can be coded
in HTML where each element's size and position can then be controlled by CSS. The platform can
be detected by a script on the page and the appropriate style sheet selected. Modern browsers
usually support media-type definition in CSS by default.
Q1: Why is the amount of space in memory that a website uses important to viewers?
...............................................
Q2: How can you ensure that your website can be viewed on all types of computer?
...............................................
© H ERIOT-WATT U NIVERSITY
TOPIC 6. TESTING AND EVALUATION 111
When evaluating if a website is fit for purpose we need to consider several things.
These are areas that you will already have considered when creating your website but should be
revisited for evaluation purposes.
6.6 Usability
Learning objective
A web site can be described as having good usability if it has clear and concise information and it is
easy to navigate for a range of users.
We would start by looking at the feedback results from our compatibility testing carried out in the
previous section, Compatibility.
© H ERIOT-WATT U NIVERSITY
112 TOPIC 6. TESTING AND EVALUATION
• Are the screens laid out appropriately, with a consistent User Interface?
• Are navigation and features obvious and working correctly?
• Have you catered for your target audience appropriately?
• Can the user find the information or features easily?
Once a website has been completed then it is good practice to try to evaluate the questions above
and evaluate the success and appropriateness of the website.
Screen layout
There should be a consistent layout throughout the product. Navigation menus, headings and
controls should always appear in the same place. Screens should not be too cluttered with
information. Where a large amount if information needs to be presented, it should be possible
to hide areas of the information (e.g. by using collapsible headings).
Navigation
Are there enough visual clues to aid navigation? Are navigation links obvious? Are menus and
sub-menus organized into sensible categories? Does the interface provide feedback about the
navigation? such as "breadcrumbs" or identifying previously visited pages.
Target audience (Personas)
You may remember from National 5 that during the analysis stage a target audience will have been
identified. This will give demographics such as the age group of the potential users and their level
of technical expertise and would have been used at the design stage to create a number of different
personas.
Usability testing will try to evaluate whether the target audience have been catered for, looking at
the use of colours, navigational complexity and amount of information on each screen.
Often an early version of the product - or even a mock-up - will be trialled with a small selection of
the target audience to ensure the interface is satisfactory. Feedback will be collected and given to
the designers to act upon.
Finding information
There is a whole set of theories around identifying how to construct information systems so that
users can navigate the product efficiently and find information on the resulting screens. Research
involving eye-tracking software has been carried out so that important information (or adverts!) are
placed in the optimum position.
Trends in User Interface (UI) design also influence how web sites are built or updated. In the early
days of the World Wide Web, every link would consist of underlined text, this is now rarely the case,
with colours, shapes and even the position of elements reflecting their intended purpose.
Evaluating usability
A number of techniques will be used to try to evaluate the usability of a product. These may
provide quantitative data about the user experience (such as how long it takes to locate a piece
of information on a mobile interface vs a desktop one) or qualitative data, such as a narrative of how
the user accomplished a task in an unfamiliar product ("I saw the destinations menu on the airport
website and figured there may be another link from there to a flight schedule for Alicante. This was
© H ERIOT-WATT U NIVERSITY
TOPIC 6. TESTING AND EVALUATION 113
• Eye tracking software to see what users are looking at on your page. This can create heat
maps to show you where users look most on your page;
• Heuristic Evaluation where the site is compared against the principles of usability;
• System Usability Scale (SUS) where the user is asked 10 questions and asked to rate their
experience on a scale from 1 to 5 (strongly disagree - strongly agree).
These scores are added together to give a usability score out of 100 and uses questions such
as:
© H ERIOT-WATT U NIVERSITY
114 TOPIC 6. TESTING AND EVALUATION
Q4: Which of the following is the correct definition of what is included under usability?
a) Screen Layout, Use of HTML5, Style sheets, Help Guide.
b) Ease of Navigation, Screen Layout, Target Audience, Ease of locating information.
c) Robustness, navigational aids, accessibility, use of standard file formats.
d) HTML5, CSS3, JavaScript, PHP
...............................................
© H ERIOT-WATT U NIVERSITY
TOPIC 6. TESTING AND EVALUATION 115
a) User preferences.
b) Bandwidth, Screen size, Web Server type.
c) Screen Size, RAM, Processor Speed, browser.
d) How useful the user finds the information.
...............................................
Q7: Style sheets help to aid maintainability by making it simpler to edit the style or format of
an entire website.
a) True
b) False
...............................................
...............................................
Q10: When assessing the usability of a website we would evaluate how it works on:
© H ERIOT-WATT U NIVERSITY
117
Topic 7
b)
...............................................
Q2: Name the necessary tags for the structure of a web page. You may choose more than
one option.
a) <title>
b) <body>
c) < head>
d) <!doctype>
...............................................
Q3: Cascading Style Sheets (CSS) rules consist of a selector and a declaration. The
declaration is made up of:
a) a list of attributes and the associated values.
b) a list of different fonts in order of priority.
c) metadata about the stylesheet.
...............................................
Q4: Which of the following makes a web page interactive? You may choose more than one
option.
a) Text
b) Buttons
c) Videos
d) Tables
...............................................
© H ERIOT-WATT U NIVERSITY
TOPIC 7. END OF UNIT 4 TEST 119
© H ERIOT-WATT U NIVERSITY
120 TOPIC 7. END OF UNIT 4 TEST
© H ERIOT-WATT U NIVERSITY
TOPIC 7. END OF UNIT 4 TEST 121
a) section.h1
b) section + h1
c) section h1
...............................................
Q18: How do you create a margin for an element with the following values?
The top margin = 20 pixels
The bottom margin = 8 pixels
The left margin = 10 pixels
The right margin = 5 pixel
© H ERIOT-WATT U NIVERSITY
122 GLOSSARY
Glossary
Alpha testing
testing of software within the development organisation which does not necessarily wait until
the product is complete.
Beta testing
getting members of the public to check a website or program for errors. Website is checked
using real world data to try to find as many errors as possible.
Client-side scripting
the scripts for a website are executed on the client's computer. This allows the code to be
viewed and copied.
Compatibility
whether or not an information system will work on a particular device.
Context of use
is the actual conditions under which a given software product/application is used, or will be
used in a normal day to day working situation.
CSS
Cascading Style Sheets, a style sheet language used to describe the look and formatting of
a document written in a markup language. It is currently on version 3 of the CSS standard
(CSS3).
Environment
is the situation in which an application or software product is used/will be used.
Field studies
research into the success of an application or to verify the needs of a target groups which is
carried out "in the field" - in real life settings with real users.
Focus group
a group of people assembled to participate in a discussion about a product before it is
developed/launched.
High-fidelity prototypes
from a user testing point of view, a high-fidelity prototype is close enough to a final product
to be able to examine usability questions in detail and make strong conclusions about how
behaviour will relate to use of the final product.
HTML
Hypertext Markup Language, a standardised system for tagging text most commonly used to
define the structure and content of a document.
© H ERIOT-WATT U NIVERSITY
GLOSSARY 123
Interviews
a face to face meeting of between the developers and one or more target users.
JavaScript
an object-oriented computer programming language commonly used to create interactive
effects within web browsers.
Low-fidelity prototypes
an early prototype that is sketchy and incomplete, that has some characteristics of the target
product but is otherwise simple, usually in order to quickly produce the prototype and test
broad concepts.
onclick
This JavaScript function is triggered when a user clicks their mouse button when the mouse
pointer is over the selected HTML element.
onmouseout
This JavaScript function detects when the user's mouse pointer moves over a selected HTML
element.
onmouseover
This JavaScript function detects when the user's mouse pointer moves away from a selected
HTML element.
Paper prototyping
in human-computer interaction, paper prototyping is a widely used method in the user-
centered design process, a process that helps developers to create software that meets the
user's expectations and needs-in this case, especially for designing and testing user interfaces.
Product owner
is the member of the team responsible for defining and prioritizing the Product Backlog so as
to streamline the execution of program priorities, while maintaining conceptual and technical
integrity of the features or components the team is responsible for.
© H ERIOT-WATT U NIVERSITY
124 GLOSSARY
Screen reader
software used by users who are blind or have impaired vision which reads the text on a web
page or the user interface of a program.
Semantic elements
Semantics is the study of the meanings of words and phrases in a language. Semantic
elements are 'elements with a meaning'. A semantic element clearly describes its meaning to
both the browser and the developer.
Server-side scripting
the code for a website is executed on the server. This does not allow the code to be viewed or
copied.
Surveys
a series of questions used to evaluation or reflect on an application.
Task analysis
is the process of learning about ordinary users by observing them in action to understand in
detail how they perform their tasks and achieve their intended goals.
Tasks
what the user has to achieve with the applications/software product.
Test methods
are approved procedures for ensure that an application meets it's requirements.
URL
Uniform Resource Locator, a reference (an address) to a resource on the Internet. A URL has
two main components: Protocol identifier: For the URL http://scholar.hw.ac.uk/ , the protocol
identifier is http . Resource name: For the URL http://scholar.hw.ac.uk/ , the resource name is
scholar.hw.ac.uk/ - the resource can include the server, port, path and filename of the resource
plus any internal anchor and/or data.
Usability
a subjective assessment of how the user finds their experience of using the information
system.
Use cases
is an approach used in system analysis to identify, clarify, and organize system requirements.
Use cases are made up of sets of possible sequences of interactions between systems and
users in a particular environment and related to a particular goal.
User
the end user of an application.
© H ERIOT-WATT U NIVERSITY
GLOSSARY 125
User persona
is a representation of the goals and behavior of a hypothesized group of users. In most cases,
personas are created from data collected from interviews with users.
User profile
is a simple representation a user. It is an initial step in the creation of a user persona.
User scenarios
describe the stories and context behind why a specific user or user group comes to your site
or use your application. They note the goals and questions to be achieved and sometimes
define the possibilities of how the user(s) can achieve them on the site.
User stories
are short, simple description of a feature told from the perspective of the person who desires
the new capability, usually a user or customer of the system.
wireframes
an image or set of images which displays the functional elements of a website or application,
typically used for planning interactions and interface elements.
© H ERIOT-WATT U NIVERSITY
126 ANSWERS: UNIT 4 TOPIC 1
© H ERIOT-WATT U NIVERSITY
ANSWERS: UNIT 4 TOPIC 2 127
Topic 2: Design
Quiz: Site structure (page 13)
Q1: In a linear structure all the pages must be accessed in the order that they are positioned in,
one after another. In a hierarchical structure the pages can be accessed in a random order.
Q2: A multi-level structure means that there are several levels in a hierarchical structure which
can be navigated between. Often, tools such as searching and backtracking will be required to help
manage navigation between pages.
Q3: Breadcrumbs are useful as they allow the user to see where the page they are on sits within
a multi-level structure, and navigate to a parent page or category easily (even if they haven't visited
it previously).
Q4: b) wireframe
Q5: a) version of the application drawn on paper with which users can interact.
© H ERIOT-WATT U NIVERSITY
128 ANSWERS: UNIT 4 TOPIC 3
Q1: c) a class.
Q3: It is a compulsory tag within the head section and it contains a title that will appear on the top
right (tab) of web pages.
Q5: b) False
Q6: b) <footer>
Q7: d) required
Q8: a) <nav>
Q9: c) <header>
© H ERIOT-WATT U NIVERSITY
ANSWERS: UNIT 4 TOPIC 4 129
Q1: a) True
Q3: a) .active
© H ERIOT-WATT U NIVERSITY
130 ANSWERS: UNIT 4 TOPIC 5
Q3: A script is extra code that is added to a web page to improve the interactivity.
Q4: Scripting languages can add interactive elements such as menus, change page contents,
validate form data, and (if server-based) access and query databases.
Q6: b) myFunction()
Q7: c) onclick
Q8: a) onmouseclick
Q9: d) Anywhere in the document between the <html> and </html> tags
© H ERIOT-WATT U NIVERSITY
ANSWERS: UNIT 4 TOPIC 6 131
Q1: If it uses too much space in memory then it may not be able to run on the user's device, and
may take too long to load if they have limited bandwidth.
Q2: Test your website on all different devices and if necessary create different versions for all types
of computer.
Q3: They make it simple to maintain consistency. They can be used to quickly adjust elements
across the product. Alternative style sheets can be used for accessibility reasons or different media
types.
Q4: b) Ease of Navigation, Screen Layout, Target Audience, Ease of locating information.
Q7: a) True
Q8: c) Errors that can only be found when running a project may be discovered.
Q9: b) all the wireframe design and displays all planned content.
© H ERIOT-WATT U NIVERSITY
132 ANSWERS: UNIT 4 TOPIC 7
Q1: a)
Q8: c) required
Q10: c) Persona
Q11: b) version of the application drawn on paper with which users can interact.
Q13: c) <select>
Q14: b) False
Q15: b) margin-left
Q16: d) #image
Q17: c) section h1
© H ERIOT-WATT U NIVERSITY