Website 1 Booklet HTML and CSS
Website 1 Booklet HTML and CSS
Many different types of code such as Python, Java, JavaScript, C++, C#, can all
be used to create different pieces of software. These could be apps (python),
video games (C++), operating systems (Windows 11 – C, C*, C++), or databases
for businesses and organisations (SQL).
Various computer languages can be used together to create a final product,
e.g: a website might include HTML5, CSS, and JavaScript.
The most popular computer languages today are Python, C++ and Java.
Repeat these steps two more times – these will be your webpages.
Remember to save the file in a folder so you can easily access it.
3
Computer Coding with HTML5 and CSS
File Types
Every file you create is saved onto your computer storage in a specific file
type or file extension, e.g; your PowerPoints are saved ending in .ppt.
We save our webpages in .html as all websites are created with HTML.
Coding is case sensitive – make sure you have typed every letter carefully.
If it is a lower-case letter, then you must type it as a lower-case letter in your
code.
4
Computer Coding with HTML5 and CSS
5
Computer Coding with HTML5 and CSS
We will be adding text and colour to our home page. To open the home page,
go to file, open index.html.
Step 1
Find the opening body tag, click after it, skip a line, and type the following text
in:
<body>
Our Home Page. Hello. This site is all about our favourite things.
</body>
On the web app, scroll down and you will see this text will appear.
Step 2
We will now include paragraph tags, <p>. This will put sentences on different
lines. Input the following code:
6
Computer Coding with HTML5 and CSS
Include a break tag. This will remove spaces in between lines. Input the
following code:
Notice something different
about the break tag?
<p>Hello. </p> <br />
Every tag in HTML5 comes in
a pair, except for a few.
Step 5
Input the following code:
<p>Hello. This site is all about our new favourite things. </p>
<p>Here is a list of things we like:<br />
Ships<br /> Remember!
Visiting Ireland<br /> You are not simply writing out new
Going Berserk<br /> code line by line, you will be asked
to go back and edit code that you
</p>
have already typed.
Step 6
Adding colour. Find the opening body tag and input the following code:
<body style=“background-color:yellow;”>
Any code typed within speech marks is another type of compute code – this
code is called Cascading Style Sheets (CSS). CSS is regularly used alongside
HTML5 to add some colour, themes and effects.
Step 7
Input the following code into the body tag. This will make all of the text blue.
<body style=“background-color:yellow;color:blue;”>
Chapter 2 – More Colour and Text
7
Computer Coding with HTML5 and CSS
In this chapter we will be adding even more and colour and editing our text.
Step 1
We will change the colour. Find the word ‘Hello’ and input the following code:
<span style=“color:red;”>Hello</span>
Step 2
We will change the font and size of text by inputting the following code:
<span style=“color:red;font-size:100%;font-family:Jokerman:”>Hello</span>
Step 3
We will change the text font for the whole webpage, by inputting the following
code:
<body style=“background-color:yellow;color:blue;font-family: Arial, Serif”>
Step 4
Find where we typed ‘Our Home Page’ and change the paragraph tags to
heading tags:
<h1 title=“Hi!”>Our Home Page.</h1>
Step 5
Now we will underline text. Go to ‘this site is all about our favourite things’ and
input the following code:
<span style=“text-decoration:underline;”>This site is all about our favourite
things</span>
Step 6
8
Computer Coding with HTML5 and CSS
Step 7
We can align our text the same way we can align text on a Word document.
Input the following code:
<h1 style=“text-align:center; title=“Hi!”>Our Home Page.</h1>
Remember to read through your work carefully to ensure you are inserting
any new code into the correct place.
9
Computer Coding with HTML5 and CSS
In this chapter we will be adding images and hyperlinks. We will start with the
images.
Step 1
Go to ‘Going Berserk <br />’ in our code and input the following:
We have added a picture to our websites and adjusted the size of it.
Step 2
10
Computer Coding with HTML5 and CSS
Go to the picture and remove the code for the width. We can use pixels as a
unit of measurement for images and videos on our sites. Change the code for
the height to the following:
<p>
<img src=“images/picture.gif” alt=“Us” style=“height:150px;” />
</p>
Step 3
Now let’s add another picture next. Input the following code:
<img src=“images/vikship.gif” alt=“ship” style=“height:150px;” />
<img src=“images/picture.gif” alt=“Us” style=“height:150px;” />
Step 4
Now we will start working on our second webpage, the ships webpage. Go to
file, open ‘ships.html’ and input the following code:
<html>
<head> File type – this tells
<title>Ships the computer what
Name of the
type of resource is
</title> folder – the
the file, e.g: - .ppt is
“images” folder.
a PowerPoint,
<head>
or .mp3 is a song!
<body background="images/irishsea.jpg">
<h1>Ships</h1>
</body> The name of the file,
e.g: a picture named
</html> “cartoonviking”.
We have inputted the code to include a
background image to our ships.html webpage.
11
Computer Coding with HTML5 and CSS
Now go and look for an appropriate background image and save it is irishsea.
Make it bright but simplistic:
Step 5
Now we will add hyperlinks onto our websites. Hyperlinks enable you to go
onto various webpages and websites. They can be identified as internal or
external.
On the home page, we will now include internal hyperlinks. This will allow the
user to navigate our website and visit each webpage. Find the ‘ships’ text and
input the following code:
Step 6
We will add external hyperlinks onto our websites. External Hyperlinks enable
you to go onto other websites. This will hyperlink a part of our text to the
Discover Northern Ireland website. Input the following code:
Step 7
We can add comments into our code that will not appear in our websites to
the user. Input the following code:
12
Computer Coding with HTML5 and CSS
display it on the website. This will be beneficial for us later as it will make our
code easier to read.
You can change the ‘Cool!’ text to anything you want. For example, as you
inserted a hyperlink, it could be changed to ‘Hyperlink’.
You have seen before that some tags work in pairs (<p> and </p>) and work
alone (<br />). Some tags require other tags to be present first for them to
work. The list tag is an example of this.
Step 1
On the Ships webpage, input the following code:
<body style=“background="images/filename.jpg">
<ul>
<li>Home</li>
<li>Ships</li>
<li>Visiting Ireland</li>
<li>Going Berserk</li>
</ul>
<h1>Ships</h1>
To include a list item <li> we need to specify the type of list. This can be an
ordered list <ol> or an unordered list <ul>.
Ordered lists will number each item, and unordered lists will simply bullet
point them.
Step 2
13
Computer Coding with HTML5 and CSS
We will now add tables to our website. Within tables, we have rows and
columns which allow us to divide the webpage into different sections for text
and content. Go to ships.html and input the following code:
<h1>Ships</h1>
<table>
<tr>
<td>Dragon Ship</td>
<td>Fast</td>
</tr>
<tr>
<td>Ferry</td>
<td>Slow</td>
</tr>
</table>
</body>
Step 3
We can colour and outline the whole table. Input the following code:
Step 4
14
Computer Coding with HTML5 and CSS
Now we will add table headings <th>. Input the following code:
<tr>
<th>Ships<th>
<th>Speed<th>
</tr>
<tr>
<td>Dragon Ship</td>
Step 5
We are going to add a title to our table. Input this code:
Step 6
We can change the colour of each table row, column or cell. Input the
following code:
Step 7
15
Computer Coding with HTML5 and CSS
We will add more pictures within the table. Input the following code:
<tr>
<td style=“background-color:blue;”>
<img src=“images/vikship.gif alt=“ship” />
</td>
<td> </td>
</tr>
</table>
Step 8
We can make features of our website stretch across rows and columns. Input
the following code:
Step 9
Let’s add another column and a picture to our table. Input the following code:
<th>Speed<th>
<th rowspan=“4”><img src= “OldMan.png” /></th>
</tr>
Step 10
16
Computer Coding with HTML5 and CSS
Now we will move the heading and the table. We will move them to the centre
of the webpage. Input the following code:
<h1 style=“text-align:center;”>Ships</h1>
Step 11
Now we will create two marquees – marquees are simply images that move.
Input the following code:
</table>
<marquee behavior=“scroll” direction=“left” scrollamount=“5”>
<img src=“images/vikship.gif alt=“ship1” />
<br />
</marquee>
<marquee behavior=“scroll” direction=“left” scrollamount=“5”>
<img src=“images/vikship.gif alt=“ship2” />
<br />
</marquee>
</body>
When you refresh your website, you will see your two ships racing.
17
Computer Coding with HTML5 and CSS
In this chapter we will look at using tables in further detail to create navigation
bars and a picture gallery.
Step 1
We will create a navigation bar. Go onto your ‘Go Berserk’ webpage
(berserk.html) and after the opening body tag, input the following code:
<body>
<table style=“background-color:lightblue;border 0px” >
<tr>
<td style=“background-color:palegreen;”>
Home</td>
<td><h1>Go Berserk</h1></td>
</tr>
</table>
Step 2
Now we will align the text. Input the following code:
<tr style=“vertical-align:top;”>
<td style=“background-color:palegreen;”>Home</td>
Step 3
18
Computer Coding with HTML5 and CSS
We will include the title of each webpage in our navigation bar. Input the
following code:
<td style=“background-color:palegreen;”>
<a href=“index.html”>Home</a> <br />
<a href=“ships.html”> Ships</a> <br />
<a href=“https://www.discovernorthernireland.com”> Visiting
Ireland</a> <br />
<a href= “berserk.html”>Go Berserk</a>
</td>
Step 4
We are going to make a cell a certain size. Input the following code:
<td style=“background-color:palegreen;width:150px;”>
Step 5
We will include hyperlinks on all our webpages and connect them. We must go
into each webpage and insert the hyperlink tag <a>. Open the home page and
input the following code:
Step 6
19
Computer Coding with HTML5 and CSS
Open the ships webpage and add the code for hyperlinks to the list:
<ul>
<li><a href= “index.html”>Home</a></li>
<li><a href= “ships.html”>Ships</a></li>
<li><a href=“https://www.discovernorthernireland.com”> Visiting
Ireland</a></li>
<li><a href= “berserk.html”>Going Berserk</a></li>
</ul>
Step 7
The text is hard to read. We will change the background of the table. Input the
following code:
<body background="images/irishsea.jpg">
<ul style=“background-color:palegreen;list-style-type:none;”>
Step 8
We will centre the text within the table. Input the following code:
<tr style=“text-align:center;”>
<td>Ferry</td>
<td>Slow</td>
20
Computer Coding with HTML5 and CSS
<head>
<style>
.tr {
text-align:center;
}
</style>
</head>
The text that we have inserted inside the curly brackets is CSS code. The
computer will read this and make the text in every table row <tr> aligned to
the centre. Any code included in the curly brackets {} will be included in all
table rows <tr>.
Step 9
If you look closely at the table, you will see a black border going around the
whole table and a yellow border going around each table cell.
We will make one black border. Input the following code:
Step 10
21
Computer Coding with HTML5 and CSS
Go to the style tag at the top of the page below the opening head tags. Input
the following code:
<style>
tr {
text-align:center;
}
td, th {
border: 1px solid black;
}
</style>
This will make all table cells and table headings have a black border around
them.
Step 11
Now we will make a picture gallery. Go to berserk.html page and include the
following code:
<h1>Go Berserk!</h1>
<table style=“border: 1px solid black;>
<tr>
<td></td>
<td></td>
<td></td>
</tr>
</table>
Step 12
22
Computer Coding with HTML5 and CSS
Step 13
We will move the position of the Viking ship to the bottom of the cell. Input
the following code:
<td style=“vertical-align:bottom;”>
<img src=“images/vikship.gif” style= “width:150px;” /></td>
Step 14
Now we will add a logo to our website for the search engines and web
browsers to display to our users.
Our logo will appear here
Find a suitable logo four our website on Vikings. The logo must be clear to see
and eye-catching but all small and simplistic. Here is an example:
23
Computer Coding with HTML5 and CSS
There are many different file types for pictures and images such as:
.jpg .png .gif .tiff
In this chapter we will add videos and sounds to our website. This will make
our site more eye-catching.
Step 1
We will begin by creating a table cell for our video. Input the following code:
Step 2
To add our video, input the following code:
24
Computer Coding with HTML5 and CSS
<td colspan=“3”>
<video autoplay controls width=“480px” height=“640px”>
<source src=“video/video.mp4” type=“video/mp4” />
This video is not supported.
</video>
</td>
Step 3
We will add sound onto our website. We will embed it using the <audio> tag.
Input the following code:
</video><br />
<audio autoplay width=“1px” height=“1px”>
<source src=“sounds/sound.wav” type=“audio/wav” />
This sound is not supported.
</audio>
</td>
We have included our movie and sound. Both will automatically play when
we load into the webpage. Also, we have included text to appear if either the
video or sound does not work. Both files should work fine when using a
Windows 11 operating system, i.e; your school computer.
25
Computer Coding with HTML5 and CSS
We have added CSS to change the look and theme of various features of our
website. We will add some more effects using advanced CSS code.
Step 1
Open the berserk.html page and find the head tags. Input the following code:
<head>
<style>
</style>
</head>
Step 2
Next we will change the colour of the hyperlinks <a> within our website. Input
the following code:
a {color:
This makes purple;} green
all hyperlinks
when they have{color:
a:visited been visited.
green;}
a:hover {color: red;} This makes all hyperlinks purple
a:active {color: blue;} when you hover over them.
Step 3
We will add a glow effect to our text. Input the following CSS code:
26
Computer Coding with HTML5 and CSS
EM… not M
Em is used to measure to size of things in CSS. 1em makes the
something the same size as the text in the tag.
1
0.1 em will make the something 10 or 10% of its original size.
Step 4
To select which text to add the glow effect, go to the ‘Go Berserk!’ heading and
input the following code:
Step 5
27
Computer Coding with HTML5 and CSS
Now we will add shadow to our text. Open the home page (index.html) and
find the <head> tags. Input the following text:
<head>
<style>
</style>
</head>
Step 6
To create the shadow effect, input the following CSS code:
<style>
.glow {
text-shadow: 0 0 0.1em red; color: white;
}
</style>
Step 7
28
Computer Coding with HTML5 and CSS
<style>
.shadow {
text-shadow: 0.1em 0.1em 0.1em purple; color: dodgerblue;
}
</style>
Step 8
Find opening head tag before ‘Our Home Page’, and input the following code:
Step 9
29
Computer Coding with HTML5 and CSS
We will add a burst of colour to our home page. This means to turn one colour
in the centre of the page into another colour. Go to the index.html webpage
and input the following code between the opening and closing style tags
<style>:
}
.burst {
background-image:radial-gradient(white, orange, dodgerblue);
height: 100%;
}
</style>
Step 10
To apply this CSS code to our webpage, go the opening body tag. Input the
following code:
Step 11
30
Computer Coding with HTML5 and CSS
Now we will make a colour fade. Go to the go berserk webpage and input the
following code:
}
.merge {
background-image:linear-gradient(to right, white, seagreen);height: 100%
}
</style>
Step 12
Add the CSS code to the following tag:
Well Done.
You have created your website.
All of the code you have used is printed at the end of this booklet.
Use it to read through your code and ensure there are no errors.
Glossary
31
Computer Coding with HTML5 and CSS
Student Notes:
32
Computer Coding with HTML5 and CSS
33
Computer Coding with HTML5 and CSS
34
Computer Coding with HTML5 and CSS
</p>
<p style="text-align:center;">Here is a list of things we like:<br />
<a href="ships.html">Ships</a><!--Cool!--><br />
<a href="https://www.discovernorthernireland.com">Visiting Ireland</a><br />
<a href="berserk.html">Going Berserk</a><br />
</p>
<p style="text-align:center;">
<img src="images/vikship.gif" alt="ship" style="height:150px;" />
<img src="images/picture.gif" alt="Us" style="height:150px;" />
</p>
</body>
</html>
35
Computer Coding with HTML5 and CSS
Ships Webpage:
<html>
<head>
<title>Ships</title>
</head>
<href="images/vikinglogo.png"/>
<body background=“images/irishsea.jpg">
<ul style="background-color:palegreen;list-style-type:none;">
<li><a href="index.html">Home</a></li>
<li><a href="ships.html">Ships</a></li>
<li><a href="https://www.discovernorthernireland.com">Visiting Ireland</a></li>
<li><a href="berserk.html">Going Berserk</a></li>
</ul>
<h1 style="text-align:center;">Ships</h1>
36
Computer Coding with HTML5 and CSS
37
Computer Coding with HTML5 and CSS
38
Computer Coding with HTML5 and CSS
Go Berserk Webpage:
<html>
<head>
<title>Go Berserk</title>
</head>
<href="images/vikinglogo.png"/>
<body>
<table style="background-color:lightblue;width:100%; height:100%;border:0px">
<tr style="vertical-align:top;">
<td style="width:150px; background-color:palegreen;">
<a href="index.html">Home</a><br />
<a href="ships.html">Ships</a><br />
<a href="https://www.discovernorthernireland.com">
Visiting Ireland</a><br />
<a href="berserk.html">Going Berserk</a>
</td>
<td>
39
Computer Coding with HTML5 and CSS
<h1>Go Berserk!</h1>
<table style="border: 1px solid black;">
<tr>
<td><img src="images/Us.png" style="width:150px;" /></td>
<td> <img src="images/OldMan.png" style="width:150px;" /></td>
<td style="vertical-align:bottom;">
<img src="images/vikship.gif" style="width:150px" />
</td>
</tr>
<tr>
<td colspan="3">
<video controls autoplay width="480px" height="640px">
<source src="videos/video.mp4" type="video/mp4" />
This video is not supported.
</video><br />
<audio autoplay width="1px" height="1px">
<source src="sounds/sound.wav" type="audio/wav" />
40
Computer Coding with HTML5 and CSS
41
Computer Coding with HTML5 and CSS
42
Computer Coding with HTML5 and CSS
43
Computer Coding with HTML5 and CSS
44