Professional Documents
Culture Documents
(YEAR 1)
SAQA ID CREDITS
24419 10
Study Guide
In terms of the Copyright Act, no 98 of 1978, no part of this manual may be reproduced or transmitted in any
form or by any means, electronic or mechanical, including photocopying, recording or by any other
information storage and retrieval system without permission in writing from the proprietor.
Web Page Design 102
CONTENTS:
CONTENTS:...............................................................................................................................................................2
INTRODUCTION TO THIS MODULE .........................................................................................................................6
INTRODUCTION ........................................................................................................................................................6
CONTENTS AND STRUCTURE .......................................................................................................................................7
SECTION 1: Web Fundamentals.........................................................................................................................7
SECTION 2: Web Development Fundamentals ..................................................................................................7
SECTION 3: Introduction to Microsoft Expression Web v4 ..............................................................................7
SECTION 4: Hyper Text Markup Language v5 ..................................................................................................8
SECTION 5: Cascading Style Sheets ..................................................................................................................8
SECTION 6: JavaScript .......................................................................................................................................8
2
Berea College of Technology
Web Page Design 102
Prescribed Text Book: There is no specific prescribed Textbook to be used in conjunction with this Manual but
1 of the following Textbooks can be used to complement this manual or a Textbook of your choice :
Ø Learning Web Design: A Beginner’s Guide to HTML, CSS, JavaScript, and Web Graphics, by Jennifer
Niederst Robbins
Ø Communicating Design: Developing Web Site Documentation for Design and Planning, by Dan M.
Brown
Ø Universal Principles of Design, Revised and Updated, by William Lidwell, Kritina Holden & Jill
Butler
Web Page Design 102
Instead, the course focuses on one area of specialisation (web development) in the context of the
overall set of roles, skills and career paths within the web development industry.
Web Page Design 102
7
Berea College of Technology
Web Page Design 102
Section 6: JavaScript
JavaScript is most commonly used as a client side scripting language. This means that JavaScript
code is written into an HTML page. When a user requests an HTML page with JavaScript in it, the
script is sent to the browser and it's up to the browser to do something with it. Javascript (JS) is a
scripting languages, primarily used on the Web. It is used to enhance HTML pages and is commonly
found embedded in HTML code. JavaScript is an interpreted language. It also covers that
JavaScript, an object scripting language which is used in web pages along with markup language
HTML. JavaScript is very popular and adopted universally by every web browser for its support
which allows dynamic content to get execute in a webpage.
The following are important Course Book Notations.
Refer to the prescribed text book Attempt the following questions and
chapters and pages specified. research further if you could not
answer the questions.
Case Study
10
Berea College of Technology
Web Page Design 102
READING
This manual has been designed to be read in conjunction with the following textbooks:
Ø Learning Web Design: A Beginner’s Guide to HTML, CSS, JavaScript, and Web Graphics,
Recommended Reading:
There are many websites that discuss good website design and case studies
of successful websites. Examples include:
http://www.thebestdesigns.com/
http://coolhomepages.com/Web-Design/blog-cat8.html
Web Page Design 102
Contents
• As you read through the material, think of websites that you use often, work
out what the motivation behind these websites and evaluate them using the
checklist provided.
1. Introduction
Websites are no longer simple. Creating a successful website requires focus,
application of effort, technological resources and money.
Given the scarcity of these resources, it is appropriate to consider the motivation
behind having a website. The key questions are:
This is not an easy question to answer. The motivations for having a website vary
widely. Here are some of them:
If you consider each of the above purposes, you can see that each purpose is
matched to a specific audience, and each audience has its own motivation for visiting
a website.
To be really successful, a website needs to communicate to a specific
audience, meet their needs as well as the organisation’s.
Measurable success
Each website, and possibly even each page within the website should now have a
clear purpose, audience, content and feature set. What remains is to ensure that the
success of the website/ webpage can be defined and measured.
In the above example, the KPIs form a conversion funnel. We want to know more
about the path of people through the website, right down to the Rand amount they
spent.
If the website and marketing campaign cost R10 000 and resulted in R400 000
of sales, then the cost was justified.
All web development occurs within budgetary constraints. According to Hatcher (2010)
the limited budget needs to be allocated appropriately to the following areas:
• Design – the overall look and feel of the website
• Content – the text, images and videos on the site
• Functions – interactive elements of the site
Figure 1: The right proportion of design, content and functions
A tutorial website is measured by its content. The users do not care too much about
the website design, and the only feature that may be necessary is a comments
system below each tutorial so that users can comment back to the author.
A bed & breakfast website needs to really show off the establishment. It needs to
be really stylish, with beautiful pictures of the rooms, gardens, surrounding area etc.
The only feature it will need is an enquiry form for people who wish to book a night’s
accommodation.
An online shop needs to be smart (so that potential customers think it is legitimate
and trustworthy), it needs to have a great product range (the content) and the online
ordering system (function) must be really easy to use, and always work correctly.
Find and read 3 blogs on good web design. Critically assess whether the
websites they review are good in terms of their balance between design, content
and functionality, or whether the review is biased towards only one of these
elements. Find one site that has following:
• A clear sense of purpose and audience
• An appropriate balance between design, content and functionality
• Gets all the fundamentals right
Discuss this site with another student in your class.
Revision Exercise 1
Purpose:
Task:
.
Web Page Design 102
CONTENTS
28
Berea College of Technology
Web Page Design 102
5. Introduction
Web development is a complex area of work. The purpose of this Learning Unit is to
give you a broad overview to the various processes and role players that are involved
in producing and supporting a successful website.
If any stage is omitted or poorly executed, the website may fail, usually in a way
that is specific to the particular stage.
Stage 1: Strategy
This stage mainly takes the form of an extended conversation between the client and
the web strategist. In many cases, clients have limited understanding of why they
want a website, and even less understanding what a website can do.
The role of the web strategist is to assist the client to explore their needs in
the context of what can be achieved with a website.
In the first part of the conversation, there are four principal questions (Hatcher,
2010) that need exploration:
9. Who will visit your website (audience)?
10. Why will they visit your website (audience’s purpose)?
11. Why do you want them to visit the website (client’s purpose)?
1. How will you know if their needs and yours have been met (KPIs)?
The second part of the conversation covers design vs content vs features. Clients
need to understand the relative importance of these three in the context of their
specific audience’s expectations.
The third part covers resources. Who will write the content, take the photos,
approve the design, and manage the maintenance work after the site is launched.
The final part of the conversation covers budget vs deliverables. Simply put, does
the client have enough money to afford the website they have requested?
Most clients are unwilling to reveal their budget, but it is helpful to obtain a rough
indication to see that the proposed website is within reach of the client.
Output:
Failure:
Site has no real purpose, invalid assumptions are made regarding cost, effort, roles
and deliverables. The website development has little chance of success unless the
project is extremely simple, or the deadlines and budget are open ended.
If the overall set of requirements is clear, and the client indicates that the
cost estimate is acceptable, proceed to the next stage.
Stage 2: Scoping
In this stage, we match technical resources to project brief – we make sure that
we can actually build the site to match client requirements, deadline and budget.
The result of this research is a document covering the following:
• Brief
o The big picture – purpose and goals
• Scope
o What will, and will not be included in the
project. Limitations and assumptions
made. Technology to be used.
• Budget
o Defines the total cost and an itemised list of costs for all elements so
that the client can understand the total cost and the items that drive the
cost up.
• Project plan
Roles and responsibilities.
Deadlines for each aspect of the website development
Output:
Failure:
The technology platform selected for the site is unable to deliver key functionality,
or the web developer lacks the necessary skills to complete the project.
If the client signs the contract and pays the deposit, proceed to the next stage.
Sitemaps
You may also include a sitemap
showing menu structure and
pages. This defines the number
of pages, as well as their
arrangement in the menu.
Read more about sitemaps here:
http://en.wikipedia.org/wiki/Sitemap
Figure 2: Sitemap (Freedom Imaging Systems, n.d.)
Wireframes
If the page layout is unusual or
important pages have a custom
layout, you can describe these
using a wireframe. The
wireframe provides a sense of
the general layout without
dealing in the specifics of styling
and wording. The simplistic
layout keeps the client focused
on the layout (structure) rather
than the design (colour scheme).
Read more about wireframing
here:
http://en.wikipedia.org/wiki/Websit
e_wireframe Figure 3: Wireframe (Rohde, 2009)
Stage 3: Development
In this stage, we build the site to specification, budget and timeframes. The process
involves installing all the necessary features, and converting the provided content
from word processor documents to HTML.
Output:
A completed site (meets the specifications in the brief) that has been launched
(made public).
Failure:
If the client confirms that they are satisfied with the result, and that all elements of
the scope have been delivered, then the project is closed, and the work shifts from
development to maintenance.
Stage 4: Nurturing
Launching the completed website is only the start of a company’s online media and
sales process. The website will need a lot of continued attention and focus in order
to achieve the specific goals defined in the initial strategy stage. Here are some of
the activities:
• Review
Set up a regular review process so that the site is not forgotten.
• System updates
If the website features contain a bug or security flaw, the developer will
release a new version which will need to be added to the site in order to fix the
problem.
• Content updates
Changing staff, products, prices and other details will need to be reflected
on the website.
• Security
Monitor hacker activity and repair any damage done by hackers.
Backups
Making a backup copy of the site in case the server hard drive crashes.
Phase 2 elements
These are additional features or improvements identified during the strategy stage
(they were not important enough), the scoping stage (they were outside the
budget), or the development stage (it is best to stick to the scope and add new
features after the website is complete).
Marketing activities
• KPI activities
Measure KPIs agreed on during the strategy stage, and ensure that targets
are being reached, or at least that the website is improving.
• ROI analysis
Measure, report on, and assess the financial return on investment from
the money put into the site development and nurturing.
Output:
An active, up-to-date, successful site which has been improved, expanded, matured
or changed since launch to better meet client needs.
Failure:
The site grows less and less useful and fails to deliver on ROI
The website eventually reaches a tipping point where the technology, content or
purpose no longer meets the company’s needs, and we return to Stage 1 to start
a new website.
The Team
• Project manager
o Keeps the project to the scope, budget and deadline. Co-
ordinates the activities of the rest of the team.
• Copywriter
o Produces the text for the website. Website content is specialised for the
web, and is in no way the same as writing for a brochure, booklet etc.
• Designer
o Produces the look and feel for the site. Creates all the required
graphics. Graphic design for the web draws on general design theory
but extends into specific areas only required for the web.
• Developer
o Codes, installs and configures the software that makes the website work.
• UX specialist
o Evaluates and improves the user experience on the site (e.g. making
navigation clearer and easier to use, moving the login button to a more
obvious location).
• Maintenance person
o Updates text, image and multimedia content on the site.
• Security specialist
o Manages server and site security, keeping hackers out of the site.
• Server administrator
o Keeps the server online and ensures that it performs adequately (e.g. that
busy sites still load quickly).
Building A Web Development Business
Given the complexities of web development today, there are several approaches:
§ Freelance, or create a small firm, and simply don’t do some of the work
Relatively unsophisticated clients just “need a basic website”. These clients are
happy with a basic HTML site without any interactive features or online marketing
activities.
Broadly speaking, there are four ways to build websites. Each approach has
strengths and weaknesses.
Text editor
Figure 4: Webpage development using a text editor
Early web developers literally typed every line of code and content using Notepad
or a similar, really simple text editor.
There are no advantages to this approach, unless you like unnecessary pain
and suffering.
These tools move beyond a simple text editor, in that they support the production
and editing of the code.
• Code completion
o The program will fill in code as you type, making it faster to develop the site.
• Code error checking
o If you make a mistake in the code, the program will highlight the mistake.
• Syntax highlighting
o Each part of the HTML and CSS code will be formatted differently, so
that it is easy to find the various code elements.
• Browser previews
o The program can show the page in Code View (just the code), Split View
(code and preview) and Design View (a simulation of what the site will
look like in a browser). The preview is faster than reloading the page in a
web browser after each code change.
The disadvantages are:
• Collaborative development is difficult
The files are on a single computer. It is next to impossible for the graphic
designer, copywriter and developer to work on the same website
simultaneously.
Whether using Notepad or a code support application, the web development work
requires that all code be prepared from scratch.
Frameworks and patterns provide libraries of reusable code that can be dropped into
a website. Examples include:
• Breadcrumb navigation elements and styling;
• Image and content sliders;
• Basic templates for the entire page.
• Speed of development
The code is copy and paste, saving lots of design, typing and testing
ü You may not understand the code, since you did not generate it.
The advantages:
ü Collaboration is easy
The graphic designer can work on the template, the copywriter can insert the
content and the web developer can adjust the layout and install advanced
features all at the same time.
The disadvantages are:
Why doesn’t this course skip writing code and just cover CMS
development instead?
Core languages
JavaScript
JavaScript is a common language for providing client-side interactions.
JavaScript makes things happen in the browser, without referring back to the
server.
Note that folder and file names are case sensitive on most web servers –
home.html is a different file to Home.html. Links with the wrong case will work when
you are testing them on Windows, because Windows is not case sensitive.
You should therefore use the following naming structure:
• All file names are in lower case
• All html files have .html extensions
• All html file names are a single word without spaces. You can choose between
the following formats for file names with multiple words:
aboutus.html about-us.html
(recommended)
about_us.html (not recommended, as the underscore is partially
obscured when links are underlined – e.g. http://www.site.com/about_us.html)
Server-side scripting
Consider a website that has content restricted to registered, logged in users. When
you load the page, you are informed that you need to login. If you are already logged
in, it just shows the content.
This is handled by programming code on the webserver. This code serves up two
different views of the same page, depending on whether the user is logged in.
Server-side scripting is often used in conjunction with online databases in order to
make the page content even more customised to the specific user. Websites built in
this way are often called database-driven websites.
All CMS systems are written in one or these server-side scripting languages.
This course does not cover server-side scripting in any detail.
Constant Innovation
Code versions
HTML has gone through several versions – HTML 1.0, 2.0, 3.2, 4 and 5. Versions 1
to 4 simply added new features. HTML 5 has fundamentally changed the code base
and approach to building website structures.
CSS has similarly gone through versions 1, 2 and 3. These have all been
incremental improvements.
Cross-browser compatibility has been a serious issue. In the early days of the
web, each web browser (e.g. Netscape and Internet Explorer) displayed the same
HTML and CSS code in quite different ways. This made it extremely difficult to
achieve a consistent display and functionality for all users on all browsers.
Nowadays, all browser developers subscribe to common coding standards, so that
all browsers display the same code in much the same way. Some layout issues
remain, for example:
</body>
</html>
Code explanation:
• All HTML elements start with < and end with >
• HTML is not case sensitive - <HTML> and <html> are both valid
• Most HTML elements form container pairs - <html> to start and </html> to
end
• The elements above are all structural – they create containers for content, but
in no way specify what the content should look like
• The browser or tab title bar reads Untitled (you have not given the page a
title yet)
Result:
At this point, the file has an HTML structure that can hold the various text and
other content elements.
So far you have just created the empty containers. Now you are going to fill the
containers with text.
Observe:
• Most of the Word formatting was removed, leaving only the content
• The paragraph structures are preserved
• The Latin text is commonly used to create a sample layout when the actual text
for the site is not yet ready. Read more about this at http://www.lipsum.com/
Observe:
• The paragraph structure in the HTML code does not show on the web browser
• The browser or tab title has changed to My First Webpage
Result:
At this point, the content has been inserted, but it has no structure or formatting.
The HTML codes below will define each piece of text as being a heading,
a paragraph, a list item etc.
Add the HTML codes:
• Return to Notepad
• Change the first heading to a Heading 1
o From: Main heading
o To: <h1>Main heading</h1>
• Change the subheadings to Heading 2
o From: Subheading
o To: <h2>Subheading</h2>
• Wrap each paragraph in paragraph tags. Each paragraph starts with <p> and
ends with </p>. Note that the headings and bulleted list do not need these
tags.
• Format the bulleted list
o Start with a <ul> and end with
</ul> Remove the MS Word bullets
and spaces
o Start each bulleted item with <li> and end it with </li>
• Save
Note:
Result:
At this point, the content is structured into headings, paragraphs and lists, but has
only the default formatting.
So far, you have created the HTML containers, and filled them with text, but
they have no styling. CSS adds the styling.
• Return to Notepad
• Create a style in the head of the document, just after <title>, before </head>
<style type="text/css">
body {font-face: verdana; padding: 20px}
h1 {font-size: 18pt;}
h2 {font-size: 14pt;}
• {text-align: justify; margin: 10px
0px;} li {color: #008000;}
</style>
Save
Observe:
Result:
The webpage now has specific formatting which overrides the default formatting.
The following code will display the date and time on which the document was
last edited. The date and time are updated automatically each time the webpage
is loaded.
<p>This document was last modified on: <script>
document.write(document.lastModified);
</script></p>
Review
• HTML – structural
o Reference: http://www.w3schools.com/html/default.asp
• CSS – styling
o Reference: http://www.w3schools.com/css/default.asp
Identify the web development role that most interests/ best suits you. Discuss this
role with another student in your class, explaining why you have selected it.
Revision Exercise
Purpose:
You need to explain the four stages of web development to your clients.
SECTION THREE: INTRODUCTION TO
MICROSOFT EXPRESSION WEB
CONTENTS
3.3 INTRODUCTION
Expression Web is an example of a Code support editor.
Review the advantages and disadvantages of using this type of software (see
page 30).
You may wish to install Expression Web 4 on your own PC in order to practice and
to do the project outside the computer labs.
You need to configure the program as follows in order to provide a user interface
and code set consistent with this manual.
Go to Tools / Page Editor Options
Go to Authoring tab
Set Default document = HTML
Set Document type declaration = HTML 5
Set Secondary schema = HTML 5
Set CSS schema – schema version = CSS 3 draft
Press OK
Note: The program installs with a default dark theme. This manual shows a light
theme in order to simplify printing. The layout and functions are identical.
The program loads in whatever workspace view you were in, and creates a new
HTML file of the type specified in your defaults (see details of installation instructions
above). In your case, the new HTML file is an HTML 5 document.
Interface Customisation
The program is designed to suit various types of user, as well as to allow personal
modifications to suit individual needs.
The program provides multiple dockable panes. You can decide which panes to
show, and where to position them. If you change the workspace, the panes
changes to suit (see below).
CSS styling
Views
Figure 13: Expression Web v4 interface – Designer workspace, Split screen view
Workspaces
There is a specific workspace configuration for each broad user type. We are
working in the Designer workspace.
To change the workspace, go to Panels / Workspaces and select a different
user type. Notice how the panes change as you do so.
Document views
• Design
Pure preview mode. No code is visible, and all edits are very similar to working
in MS Word.
• Split
A mix of Design View and Code view. Making a change in one part of the split
pane causes an update on the other pane.
• Code
Pure code view, with no preview. This view maximises the screen available for
code, and would therefore be preferred by users who only work in code.
Developing Code
The primary purpose of Expression Web is to support you to write your own
code, and to insert code for you.
Expression Web “Intellisense” helps you to enter code in the following ways:
Apart from supporting you to write code, Expression Web is also able to generate
the code for you.
Design mode
If you add structure (HTML) or styling (CSS) in the design mode, the code is
generated for you.
Snippets
Templates
As you saw earlier in the course, websites are made up of several folders and
files. The relationship between these files is critical, especially when inserting
hyperlinks between the pages, or references from one file to another (e.g. an
HTML file referencing an image).
Expression Web cannot make file reference links (such as hyperlinks or style sheet
references) unless it is sure of the file location (so that relative links can be used). If
you find that the hyperlink menu items are greyed out, you need to first save the HTML
file that you are working on. The menu items will then be activated again.
It is possible to open a single HTML file in Expression Web, in order to make content
changes, for example. However, you need to watch out if you are making changes
that involve linking to other files. Here is a good example of the problem – an image
element.
<img
src="file:///C:/Users/Joe%20Bloggs/Documents/MyWeb/images/chair.jpg
" width="250" height="300" >
This image element refers to the C: drive, then to a series of folders and sub-
folders and then to an image called chair.jpg.
This image will display on Joe Bloggs’ computer, even when they upload the
website to the webserver. No-one else will ever see the image.
Why?
.....................................................................................................................................
.....................................................................................................................................
.....................................................................................................................................
.....................................................................................................................................
.....................................................................................................................................
.....................................................................................................................................
.....................................................................................................................................
Expression Web uses the concept of a “site” to bring together all the
resources required to display the website.
A site is simply a folder on your PC where all the project files (webpages,
images, videos etc) will be saved.
If you create a site first, load the site and then the files, Expression Web will always be
able to build relative links between files, avoiding the issue described above.
Create a site:
Purpose:
Task:
59
Berea College of Technology
Web Page Design 102
CONTENTS
60
Berea College of Technology
Web Page Design 102
62
Berea College of Technology
Web Page Design 102
4.3 Introduction
Understanding HTML
HTML is very simple to use, provided you pay close attention to the fundamentals.
You must be absolutely clear of the structure and purpose of the following:
• Elements
• Tags
• Attributes
Hyper Text Markup Language (HTML) is a markup language. This means that text
(e.g. a paragraph) is wrapped in a set of markup tags (w3schools.com [1], n.d.).
Example: Headings
Attributes
Example: Images
Syntax
Tags are not case sensitive – e.g. <h1> and <H1> are both acceptable.
Attribute values should be enclosed in double quotes – e.g. width="120".
Overall file structure
Doctype
The doctype is the first line of the HTML file. It formally declares which version of
HTML you are using. This assists the web browser to display the content correctly.
For an HTML 5 document, the doctype is:
<!DOCTYPE html>
File structure
<!DOCTYPE html>
<html>
<head>
<title>Title of the document</title>
<head>
<body>
The webpage content goes here
</body>
</html>
Orderly HTML
When you insert a container, the start and end tags are usually close together. As you
add content to the container, the start and end tags end up several lines apart. You
may then end up adding another container inside the first. This can get really
confusing to read.
Common ways to deal with this include HTML comments and indented code.
HTML comments look like this <!-- This is a comment -->
Consider the way that the comments and indents make it easier to read the following
code block.
<!DOCTYPE html>
<html>
<head>
<!-- Add the page title here -->
<title>Title of the document</title>
<head>
<body>
<!-- Start of content here -->
The webpage content goes here
</body>
</html>
Paragraphs, divs and spans
Paragraphs, divs and spans are all containers that can be used to hold text. In
general, you should use them as follows:
• Paragraphs
Actual text paragraphs
• Divs
Block elements that contain multiple paragraphs or A heading
other text elements and or images Lorem ipsum dolor
sit amet, adipiscing
• Spans elit.
Inline text elements that will be styled
Maecenas eget diam
A sidebar is a column on the left or right of the main content risus, ut diam.
area. The sidebar typically holds a menu, as well as
newsletter subscription forms, testimonials, guarantees and
Figure 16: Example sidebar
product specials. The HTML code for the example sidebar
in Figure 16 is:
<div>
<h1>A heading</h1>
<p>Lorem ipsum dolor sit amet, adipiscing elit.</p>
<p>Maecenas <span>eget diam risus</span>, ut diam.</p>
</div>
• Semantic containers
HTML 5 introduces the concept of semantic elements. These are HTML containers
similar to CSS DIVs, except that the name of the container means something.
In HTML 5, we can code the same menu as follows, and now the search
engines know that the code block is a menu:
<nav>Home | About Us | Products | Contact</nav>
Purpose:
The graphic designer has produced a template for the website. The template CSS file
will control the presentation and styling of the HTML elements. Your job is just to insert
the relevant text and then mark it up using HTML.
Line Breaks
Line breaks are especially important when the webpage styling includes automatic
spacing between paragraphs. Consider the following text:
<p>Phone:</p>
Bold
Italic
Underline
Underline is seldom used, except in cases such as academic referencing, where book
titles may be underlined. Try to avoid underlining normal text, as users may then
interpret the underline as being a hypertext link, and try to click on it.
Lists
Bulleted list
Bulleted lists should be used for point form text where the items in the list are not in a
particular order. The structure is as follows:
I like: <p>I like:<p>
• Pizza.
• Reading. <ul>
• Music. <li>Pizza
<li>Reading
<li>Music
</ul>
Numbered list
Numbered lists should be used for items that are in a logical order (e.g. steps in a
recipe) or where reference to a specific item will be necessary (e.g. a contract in which
one paragraph refers to another – e.g. See point 4 above). The structure is as follows:
.
Activity Mark up a list
Purpose:
Instructions:
Bulleted list
Numbered list
Nested lists
You can insert one list inside another. Modify the numbered list as follows:
I like:
1. Pizza
1. Must have lots of garlic
2. Cheese must be stringy
2. Reading
3. Music
Tables
Tables (with invisible borders) have historically been used to create page layouts.
However, this is now considered bad practice (Kyrnin, n.d.). Tables should only be used
for the presentation of actual tables (e.g. a price list) within the content of the page.
Tables such as the one below are defined differently in HTML than in MS Word:
• Word – 3 columns and 2 rows
• HTML – 2 rows, 3 cells in each row
Core table elements Example table
Given how much code is required to generate a table, you can consider using the
Expression Web code generator to make the table for you. Go to Table / Insert
Table
The interface is very similar to that in MS Word, except that there are settings
specific to HTML tables which are not found in word processor tables.
Purpose:
You can merge rows and columns to create more complex layouts.
Columns are merged using the colspan attribute.
Rows are merged using the rowspan attribute.
Note that the cells that have been merged are reduced to a single <td>.
2012 price list <table cellspacing="0"
Code Product Price cellpadding="4">
001 Blue pen 12.34 <!--Row 1-->
<tr>
<td colspan=3>
<h3>2012 price list</h3>
</td>
</tr>
<!--Row 2-->
<tr>
<td>Code</td>
<td>Product</td>
<td>Price</td>
</tr>
<!--Row 3-->
<tr>
<td>001</td>
<td>Blue pen</td>
<td>12.34</td>
</tr>
</table>
Activity Add a merged row
Purpose:
Images
Uses of images
• Background styling
Background images create visual effects on the whole page, a content block or an HTML
button. These images therefore usually form part of the overall template for the site.
Background images are inserted using CSS (see Learning Unit 5).
• Content
These are images that form part of the website content – e.g. a product photo.
• JPG
A bitmap format with full colour. Images are compressed to reduce the file size, but the
compression results in a loss of quality. JPG images cannot have transparency. Use
JPG for photos.
• PNG
A bitmap format with full colour. Images are compressed to reduce the file size, and the
compression results in no loss of quality, but bigger file sizes. PNG images can have
transparency. Use PNG for logos and non-photographic images.
These terms are explained in Activity 10 below.
Image location
Image attributes
The following attributes apply to images. The positioning and styling options are
found in CSS, not HTML.
• Height and width
The dimensions of the image in pixels. This attribute needs to be omitted when building
responsive websites (see page 35).
• Alt
This is a text description used by screen readers. Screen readers are programs that read
out the content of the website to the blind user. The alt description is also used by search
engines to find out what an image is about.
Activity Insert an image
Purpose:
Links
Links, or, more correctly, hyperlinks, are a core feature of the web.
You should make it as easy as possible for the user to use the site by “rich linking”. For
example, instead of relying on users returning to the products main page to get to the
next product, have a small product menu on every page.
When you mention a product in the text, make sure that you link the name to the
specific page for that product.
Syntax
Purpose
Allow users to move from one webpage to another on the same website.
Structure
These links within your website (e.g. from the home page to the contacts page) are
always formatted as relative links. Relative links do not specify the domain name, and it
is assumed that these links refer to the same website as the page that the user is
currently on.
<a href="contact.html">Contact us</a>
1. The user is on www.site.com
2. They click on a link to contact.html
3. The browser loads http://www.site.com/contact.html – the
browser combines the current domain name with the selected file name and
builds the URL to be visited.
Inserting this link type in Expression Web
Ideally, you should have all the webpages already saved in your site folder (they can be
blank).
1. Create the link text, or insert the image that will be a link
2. Select the text or image, being careful not to select a space before or after
the text
3. Go to Insert / Hyperlink
If the Hyperlink menu option is greyed out, just save your file and then try again.
4. Browse to the folder
5. Click on the file
6. Press OK
If you have not already made the page that you are linking to, you can simply type
the filename in the Address field.
Purpose
Structure
1. Create the link text, or insert the image that will be a link
2. Select the text or image, being careful not to select a space before or after
the text
3. Go to Insert / Hyperlink
If the Hyperlink menu option is greyed out, just save your file and then try again.
4. In the Address field, enter the web address, starting with http://
5. Press OK
If you want the other website to open in a new window, leaving your website open in
the first window, adjust the link code as follows:
<a href="http://www.anothersite.com" target="_blank">Visit our
website</a>
A link to a location on the same page
Purpose
If you create a really long page, and cannot break it into separate pages, then create a
Table of Contents at the top of the page. When users click on a link, the page scrolls
down to the relevant heading or section.
Structure
The code consists of two parts – the hyperlink, and the target location on the page.
Table of Contents:
<ul>
<li><a href="#product-1">Product 1</a></li>
<li><a href="#product-2">Product 2</a></li>
<li><a href="#product-3">Product 3</a></li>
</ul>
1. Create the link text, or insert the image that will be a link
2. Select the text or image, being careful not to select a space before or after
the text
3. Go to Insert / Hyperlink
If the Hyperlink menu option is greyed out, just save your file and then try again.
4. Press the Bookmark button
5. Select the relevant target
6. Press OK
7. Press OK again
A media resource
Purpose
A hyperlink can open an image, video or text block in a popup.
Structure
This is often done using the lightbox effect. The screen goes grey and the image or
video appears in a box in the center of the screen.
You will create a lightbox image gallery in the JavaScript part of this course.
Purpose
When the user clicks on the email address, it starts a new email message. This relies on
the user’s web browsing device having a configured email application (e.g. Outlook), so
it should be avoided.
Structure
Table of Contents
Inline link
• Inline links
These are found within the text on the webpage.
Referencing folders
The following hyperlink is relative. It contains only the name of the file to be loaded,
without specifying either the domain or the folder. In most cases this will work
correctly.
<a href="contact.html">Contact us</a>
Imagine a larger website, with thousands of pages (e.g. a large company with several
divisions). In such a situation, you might have folders for each division so that file
management is easier. Relative links then get a bit more complex. You are on:
http://www.site.com/international-sales/south-africa.html
You want to follow a link back to the overall website home page. The link needs to “hop”
from the international-sales folder back to the root (public_html) folder of the site.
The link would be structured as follows:
<a href="../index.html">Home</a>
The ../ hops back one folder level.
This concept and syntax also applies to any HTML code that refers to other files:
<img src="../images/logo.png">
Purpose:
Purpose
The user cannot phone because they are looking at the site after hours.
They send an email, but leave out critical information in their request. The sales
representative then has to contact them and ask for further information before they
can provide a quote.
The user fills in the form, providing complete information about their requirements.
The sales representative is able to provide a quote without needing any more
information from the user.
Common forms
• Enquiry form
As in the example above
• Login form
A form that collects username and password, granting the user access to the
restricted areas of the site.
Structure
<form> container
All forms start with <form> and end with </form>. There are several attributes.
<form method="post" action="submit.php">
…
</form>
Labels
Labels are text snippets that label each field so that the user knows what to fill in.
The label “for” must match the ID of the field (see below).
Fields
A field is the space where the user types or makes selections. There are several field
types. The following code is for a text field.
Text
Text area
A larger block for entering more text – e.g. a comments box Note
that the code is very different to the other field types.
Password
Same as a textbox, but the data entered by the user shows up as stars instead of
revealing their password to people looking over their shoulder.
<label id="Password">Password</label> <input
name="Password" type="password" />
Select
<label id="Province">Province</label>
<select name="Province">
<option value="">Please choose</option>
<option value="KZN">KwaZulu-Natal</option>
<option value="GP">Gauteng</option>
</select>
Checkboxes
<h1>Interests:</h1>
<input name="Interests" type="checkbox" value="Movies" />
<label id="Interests">Movies</label><br>
<input name="Interests" type="checkbox" value="Theatre" />
<label id="Interests">Theatre</label><br>
<input name="Interests" type="checkbox" value="Concerts" />
<label id="Interests">Concerts</label><br>
Note that the name of each checkbox in the group is the same, and the value defines
the content of each checkbox. If you do not do this carefully, the form will submit, but the
recipient won’t be able to understand the content. Here is an example of a form gone
bad:
Note that for checkboxes and radio buttons, the label is placed after the field.
Radio buttons
Radio buttons have the same structure as checkboxes but are only presented in
groups, never singly. While checkboxes allow for multiple items to be selected, radio
buttons only allow for one item in the list to be selected.
<h1>Mailing<h1>
<p>How often would you like us to mail you regarding upcoming
events?</p>
<input name="Mailing" type="radio" value="Daily" />
<label id="Mailing">Daily</label><br>
<input name="Mailing" type="radio" value="Weekly" />
<label id="Mailing">Weekly</label><br>
<input name="Mailing" type="radio" value="Monthly" />
<label id="Mailing">Monthly</label><br>
<input name="Mailing" type="radio" value="Never" />
<label id="Mailing">Never</label><br>
It is essential that all radio buttons in the group have the same name, otherwise the
user can select multiple radio buttons instead of just one. In the above example,
name="mailing" groups all the radio buttons together.
Submit button
Clicking on the Submit button causes the form data to be submitted back to the
webserver for processing.
You can change the wording on the button by editing the value attribute.
When the user presses the submit button, some or all of the following happen.
Validation
Has the user filled in the required fields?
If so, send the data.
If not, request the data before sending.
You will add validation to this form later in this course (See Learning Unit 6).
Submission processing
Data delivery
Usually the form data is sent to the website owner or person responsible for replying. It is
also a good idea to also send the form data to the user who submitted it, for their own
records.
Data capture
Some form processors also save the incoming data to an online database. This is a
good idea, as the email to the website owner could easily get lost, and it is hard to find
the details of previous submissions if they are not in a database.
Activity 12 Create a form
Purpose:
Instructions:
The client wants to gather information about users. They have provided you with the
following basic requirements:
• First and last name
• Email address
• Province – the company only operates in KwaZulu-Natal and Gauteng
• Interests – users must select one or more of movies, theatre, concerts, and
must be able to type in their own interests as well
• Mailing – users must choose either daily, weekly, monthly or never receive
mails
The UX (User Experience) specialist has defined the form for you as follows:
Labels and headings Field type Option values
Personal Details Heading 2
First Name Text
Last Name Text
Email Text
Province Select KZN – KwaZulu-Natal
GP – Gauteng
Interests Heading 2
Interests Checkboxes Movies, Theatre, Concerts
Other Interests TextArea
Mailing Heading 2
How often would you like us to mail Paragraph
you regarding upcoming events?
Frequency Radio group Daily, Weekly, Monthly,
Never
Submit your details Submit
button
Limitations of HTML 5
At the time of writing (October 2012), HTML 5 is in draft form, and is therefore not an
official standard (w3schools.com, n.d.). This means that some features of HTML 5 do
not currently work in all web browsers (see the section on cross-browser compatibility).
However, this will improve over time.
CONTENTS
75
Berea College of Technology
Web Page Design 102
77
Berea College of Technology
Web Page Design 102
5.3 Introduction
Understanding CSS
• Location
Where do you put the CSS code?
• Syntax
How do you write CSS code?
Remember, Cascading Style Sheets (CSS) are used for styling (see page 33). To
understand the separation between structure (HTML) and design (CSS), consider the
CSS Zen garden.
This site contains a single page of HTML.
Designers from around the world are invited to submit a CSS style sheet and
associated images.
You can load the site with any of the style sheets, and see a completely different
presentation each time. In each presentation, the underlying HTML file has not been
changed in any way.
CSS Zen Garden HTML page CSS Zen Garden sample page (with CSS)
http://www.csszengarden.com/zengarden-sample.html http://www.csszengarden.com/
• Inline styling
This provides styling for the specific HTML element only. All that is
required is a code snippet inside the HTML tag.
Syntax
General syntax
h1 {color: red;}
Example webpage – index.html:
<!DOCTYPE html>
<html>
<head>
<title>My Website</title>
<link rel="stylesheet" type="text/css" href="css/style.css">
</head>
This particular page will have a black background and all Heading 1 headings will be
green.
<!DOCTYPE html>
<html>
<head>
<title>My Website</title>
<style type="text/css">
body {background: black;}
h1 {color: green}
</style>
</head>
Inline styling
On this specific page, all Heading 1 headings will be green, except for the first one,
which will be grey.
<html>
<head>
<title>My Website</title>
<link rel="stylesheet" type="text/css" href="style.css" />
<style type="text/css">
body {background: black;}
h1 {color: green}
</style>
</head>
<body>
<h1>This is a heading</h1>
In the code block immediately above, the HTML page has an external style sheet, an
internal style sheet and inline styling. In each case, the colour of the heading is
specified, and they conflict with one another.
How does the browser resolve which colour to use?
1. As the browser loads the HTML page it encounters the link to the external style
sheet, and loads that file. At this point, all Heading 1 headings will be red.
2. On the very next line of the HTML file, the browser encounters the internal style
sheet. At this point all Heading 1 headings will be green.
3. Finally, the browser encounters the inline styling encounters the inline styling
on the first heading, making that one grey. The rest remain green.
As can be seen from this example, the general rule is that the last-encountered style
attribute is the one that is applied.
Importance overrides
Style sheet:
h3 {color: blue}
.golden {color: gold}
Child classes
Style sheet:
h3 {color: blue}
aside h3 {color: gold}
HTML code on the webpage:
You can apply a single set of CSS attributes to multiple HTML tags. In the following
example, all the heading levels are styled globally, and then individually.
h1, h2, h3, h4, h5, h6, h7 {font-family: Tahoma}
h1 {font-size: 28pt; color: red}
h2 {font-size: 24pt}
h3 {font-size: 20pt}
<div id="header"></div>
<h1>Heading</h1>
<p class="quote"></p>
You can have several quotes on one page, so the quotes need to use class, not ID.
Notice:
• IDs have a # in front of the name
• HTML elements have no character in front of the name
• Classes have a dot in front of the name
Combining HTML and CSS
CSS containers
A DIV is a container, but it is part of the CSS code set, not the HTML code set. It
creates a block element that, by default, fills the entire width of the container that it is in.
<body>
<div><img src="images/logo.png"></div>
The above div creates a block that spans the entire width of the page. It contains the
logo image.
A SPAN is an inline container. It is, by default, only the width of its content.
Or different settings for each side, in this order - top, right, bottom, left…
Floats
Block containers (such as DIVs and paragraphs) occupy the full width of the space
allocated, even if you make them less than 100% wide. The main method of placing
HTML elements next to a block element is to float it to the left or right. The most
common reasons to float containers are:
• To wrap text around an image
• To position sidebars
The vertical position of the floated object is determined by the position of its code
relative to the rest of the page.
Figure 21: Vertical alignment of floats
Purpose:
Colours
Colour systems
Colours on websites are specified using Named Colours and RGB (Red, Green, Blue)
values. There are only 147 named colours, but 16.7 million RGB values! Most of the
time, the Graphic Designer will specify the colours in RGB, as this is the most versatile.
If the Graphic Designer specifies colours in CMYK or another colour system, then they
do not understand colour for the web. Only HTML named colours and RGB values are
suitable.
Both colour systems can be applied using HTML and CSS.
Named colours
RGB values
RGB values are usually given in hexadecimal (see #DC143C below) or, less
commonly, as three numeric values.
1. Type color:
2. Open the style sheet
3. At the appropriate location,
type color:
4. A drop down list of named colours
will appear
5. Double click Pick color… at the top
of the list
6. Select from:
•Standard colours from a colour
wheel
Figure 23: CSS colour picker
• Click on Custom to enter RGB
values
• Use the eyedropper to pick a colour from anything visible on the screen 7. Press OK
Further resources
Borders
Purpose:
Any element can be filled with a graphic or a single HTML colour, or a CSS gradient
(see below).
A background image is usually a seamless repeating tile.
This is a small graphic that, when placed next to itself forms a seamless block (does not
show the borders of each repeated image). This is useful because webpages are a
variable width and length, so we cannot create a single, big image to “fill the screen”.
Figure 24: Seamless tiling – the border shows the boundary of the small image that has been
repeated.
You can also repeat background graphics in a single direction (e.g. across the page
only).
You can add a background color instead of, or in addition to, a background image. In the
following example, the image will repeat across the page only, and the rest of the
container will have a light grey background (#f4f4f4):
Path issues
In the above example, the image (bg5.gif) is in a project subfolder. The html files are in
/myproject and the image files in /myproject/images
Because we are using relative paths, you do not need to reference myproject when
referring to the image in the images folder.
If we were to move the background image formatting to an external style sheet, the
above code would no longer work.
CSS file: /myproject/css/template.css
<div class="wrapper">
…
</div>
Here is why
The background image path is now relative to the CSS folder path. The web browser
will try to load the image from /myproject/css/images/bg5.gif – the image folder location
is wrong!
The correction is
.wrapper {background: url('../images/bg5.gif') repeat-x #f4f4f}
The ../ says “Go back one level from /myproject/css/ to /myproject. Then go
forward to the /myproject/images folder and fetch bg5.gif”
Purpose:
Character formatting
The following styling can be applied to anything from a single character of text to an
entire website.
Font
You can specify a font for any HTML element. The font must be installed on the
user’s computer, which restricts your selection to a small set of fonts.
<p style="font-family: Verdana">…</p>
You can specify a set of fonts so that, if the first is not installed, the second is
selected.
<p style="font-family: Verdana, Arial, sans-serif">…</p>
Finally, you can integrate Google Web Fonts to select from over 560 fonts (and
growing). This technique works whether the font is installed on the user’s computer or
not. See http://www.google.com/webfonts.
Text size
The size of the text can be set in points, pixels, ems or percentage of base text size.
For the purposes of this course, we will use pixels.
The default text size on most web browsers is 16px. Headings will therefore need to be
larger than 16px and fine print smaller than 16px. External or internal style sheet
example:
h1 {font-size: 28px}
Inline styling example:
Text colour
This uses the standard colour specifications and insertion method (see 89). The
CSS code is:
Character spacing
Letter spacing increases or decreases the space between characters in the text
h2 {letter-spacing: 10px}
Word spacing increases or decreases the space between words in the text
h2 {word-spacing: 10px}
Text shadow
This specifies the shadow effect added to text. It is mostly used on large text sizes such
as headings. The two pixel values define the offset (right, then bottom). 1px 1px means
that the show starts 1px to the right of the text, and 1px below the text. The hexadecimal
colour value sets the shadow colour.
The following styling can be applied to any block of text (paragraph, div, span, table
cell etc).
Alignment
h1 {text-align: center}
p {text-align: justify}
.footer {text-align: right}
Line height
This functions in a similar way to line spacing in MS Word. Use this CSS style to
create space between lines of text within a block.
Explore text formatting further at http://www.w3schools.com/css/css_text.asp
Activity Text styling
Purpose:
Review general CSS concepts and apply character and block level text styling.
Hyperlinks can have several states. The order of link styles in the style sheet is
important. Add them in the following order:
• A link
This is a normal hyperlink that has not been visited, and is not being hovered on.
• A visited link
This is a link that has been visited before using the current web browser (and the web
browser has the link in the browsing history). The purpose of this link state is to help
users identify webpages that they have already viewed.
• A hover link
This is the link state when the mouse is over the link.
• An active link
This is the link state as the user clicks on it.
CSS styling is commonly used to remove underlines on menu items and create hover
effects on menus.
a {text-decoration: none; background: white; color: blue}
a: hover {background: green; color: white; font-weight: bold;}
ul { list-style-type: x}
x = circle, disk (default), square
ol { list-style-type: x}
x=
• lower-alpha, upper-alpha
• lower-roman, upper-roman
Example:
<style type="text/css">
ul {list-style-type: square;
margin: 0px;
padding: 0px;}
</style>
Discuss with the person sitting next to you:
1. Why was there a difference between the bullet position in the Expression Web
preview and in the actual web browser? .............................................................
............................................................................................................................
............................................................................................................................
............................................................................................................................
............................................................................................................................
2. What are the implications for design work precision for items other than
bullets? ...............................................................................................................
............................................................................................................................
............................................................................................................................
............................................................................................................................
Answers
1: All Design previews display discrepancies between the preview screen and the
actual display in a web browser.
2: You cannot really trust the preview in Expression Web. You really do have to
save the changes and preview them in at least one web browser.
Table styling
Instructions:
Note that the borders between the table cells are not correct – some of the borders that
are meant to be 1px thick are actually 2px. Discuss this issue in class and work out what
is wrong and why. Apply a CSS attribute that fixes this issue.
By default, cell content aligns to the center of the cell vertically. However, most of the
time, we would want the text to align to the top of the cell. To do this:
td {vertical-align: top;}
Image Styling
However, paragraphs in the sidebar should not be justified, as the spacing looks
strange.
p {text-align: justify}
.sidebar p {text-align: left}
Note that the second line specifies “paragraphs inside the sidebar container”.
The order is important. The sidebar code must appear in the CSS file after the
general paragraph code.
Consider a site that has a blue sidebar, a white content area and a black footer.
Each of these containers contains hyperlinks. The CSS code would be:
• The first line sets global parameters (all links have no underline).
• The first line also sets the default link colour to green. This will affect the links
in the main content area.
• The sidebar and footer lines set specific link colours for those areas.
Many HTML elements have similar block or inline properties to divs and spans.
For example, an H1 is a block element – no text can appear alongside an H1. A link is
an inline element.
In all cases (CSS and HTML), the element’s default characteristics can be overridden
using CSS.
Consider a menu made up of a bulleted list. Each menu item hyperlink is as long as
the text on that line. This is because links are inline elements. This creates the
following problem.
<nav>
<ul>
<li><a href="index.html">Home</a>
<li><a href="about.html">About Us</a>
<li><a href="tips.html">Tips</a>
</ul>
</nav>
The problem is that “Home”, “About Us” and “Tips” are different lengths, and the
menu items do not look neat.
The solution is to transform the hyperlinks from inline elements to block elements, so that
they all occupy the full width of the sidebar, no matter how short the text of each link.
<nav>
<ul>
<li><a href="index.html">Home</a>
<li><a href="about.html">About Us</a>
<li><a href="tips.html">Tips</a>
</ul>
</nav>
CSS 3 formatting
CSS 3 has several new features that make the production of websites a lot easier.
Unfortunately, these features are quite new, and therefore not all web browsers
support them, or support them in exactly the same way.
Rounded corners
Gradients
CONTENTS
77
Berea College of Technology
Web Page Design 102
JavaScript adds a third programming language to those covered already. Just as HTML
has a purpose (structure) and CSS has a role (styling), so too does JavaScript
– mainly client-side page manipulation/interactions.
Client-side interactions are activities that happen in the web browser without further
interactions with the server.
There are several ways to develop JavaScript code for your site.
• From scratch
You can write your own JavaScript code from scratch. However, unless your
requirements really are unique, you are re-creating code that already exists.
By far the best approach is to use the JQuery code library (http://jquery.com/) and
example scripts. JQuery saves a lot of development time, is well documented and
supported by many users, and all code produced using JQuery will be similar,
reducing your effort to understand and integrate it.
According to builtwith.com (2012), JQuery is used on 50% of the top 10,000 sites
in the world.
Integrating JavaScript into your Website
JavaScript files are integrated into the website in the same way as CSS:
• External Javascript
Separate file, usually in a sub-folder called js
• Internal JavaScript
A block of code in the <head>
• Inline JavaScript
A code snippet inside an HTML element
The code for calling an external Javascript is placed in the <head> container:
Your website needs to call an external JavaScript file that contains the JQuery
library. There are a variety of methods. The simplest is to fetch the script from the
Google API library. A single line of code in the <head> of the page is all that is
needed.
<script
src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.j
s"></script>
Note: On campus, you may need to login in the browser in order to fetch the JQuery
library from Google.
©
Case study 1: Form validation
7.
Activity 23 Add required field validation to a form
Purpose:
Instructions:
The User Experience expert has reviewed the website development and is
concerned that the Contact Me form is not user friendly. Specifically, the required
fields do not validate. This means that users can submit incomplete form data.
As the web developer, you have decided to use a JQuery snippet to manage
form validation.
You can use JavaScript to obtain the file modification date and display it
automatically.
<div class="footer">
<script>
var theDate=new Date()
document.write("©" + theDate.getFullYear())
document.write(" Company X | Last modified: ")
var theModifiedDate=new Date(document.lastModified)
document.write(theModifiedDate.toDateString())
</script>
</div>
• The two vars set up variables to hold the current date and the date the file
was modified.
• The document.write elements display the text and formatted variables on the
page.
• document.lastModified fetches the update date from the file properties.
• The toDateString() function displays the date in a neat, human-friendly
format.
www.w3schools.com
www.codeacademy.com
www.developers.google.com
www.google.com
Learning Web Design: A Beginner’s Guide to HTML, CSS, JavaScript, and Web Graphics,
by Jennifer Niederst Robbins
Communicating Design: Developing Web Site Documentation for Design and Planning, by
Dan M. Brown
Universal Principles of Design, Revised and Updated, by William Lidwell, Kritina Holden
& Jill Butler