Spot the mistakes in the HTML
<!doctype html>
<hmtl>
<head>
<h1>Sample webpage</h1>
</head>
<body style="colour:green;">
<title>My website</title>
<para>This is a paragraph of text. <a href=page1.html>This is a link</a>.</para>
</body>
</hmtl>
Spot the mistakes in the HTML
<!doctype html>
<hmtl>
<head>
<h1>Sample webpage</h1>
</head>
<body style="colour:green;">
<title>My website</title>
<para>This is a paragraph of text. <a href=page1.html>This is a link</a>.</para>
</body>
</hmtl>
Understand how websites are built with HTML, CSS and JavaScript
Be able to write use CSS to style a webpage
You will not learn to code from simply being told how to do it, learning to code becomes more natural the more you do by learning it yourself.
Toggle CSS
p {
color : green ;
}
The selector
The properties and property values
p {
color : green ;
}
Describes what we want to style
Describes how we want to style it
<!doctype html>
<html>
<head>
<title>A sample webpage</title>
<style>
h1 {
background : green;
}
p {
font-size: 25px;
}
</style>
</head>
<body>
<h1>Welcome!</h1>
<p>Welcome to my website!</p>
</body>
</html>
h1 {
background: green;
}
.green_text {
color: green;
}
#main_content {
width: 600px;
}
Font colour
font-color: green;
font-color: #0a0;
Background colour
background-color: red;
background-color: #a00;
Font size
font-size: 14px;
font-size: 12pt;
Font family
font-family: "Times New Roman", serif;
font-family: "Helvetica", "Calibri", sans-serif;
Width
width: 500px;
width: 50%;
Height
height: 300px;
height: 50%;
Padding
padding: 5px;
Margin
margin: 5px;
Border
border: 1px gray solid;
h1 {
}
h1 {
}
<p class="green_bg">
This paragraph should be green
</p>
<img id="big_image" src="image1.jpg">
h1 {
}
Notice the class attribute
Notice the ID attribute
.green_bg{
background: green;
color: #fff;
}
#big_image {
width: 600px;
height: 500px;
}
h1 {
}
A dot represents a class selector
A hash sign represents an ID selector
<div>
<div class="column">
Column 1
</div>
<div class="column">
Column 2
</div>
</div>
.column {
display: inline-block;
width: 50%;
margin: -1px;
padding: 0;
}
.column {
display: inline-block;
width: 50%;
margin: -1px;
padding: 0;
}
Now that you have a bit of CSS knowledge, you can now add some CSS to your own websites!
Use the CSS booklet to help you to add CSS to your websites.
Apply a filter: