Professional Documents
Culture Documents
Lecture 1B - Introduction To HTML (Part 1)
Lecture 1B - Introduction To HTML (Part 1)
L
E
C
T Introduction to
U
R
HTML
E
Fundamentals of Computing
Polytechnic Foundation Programme
1B 2022/23, Semester 2
Official (Closed) - Non Sensitive
Objectives
Topics
What is HTML?
Structure of an HTML document
A simple HTML document
Create a web page with HTML Tags
Create List and Links in HTML document
What is HTML?
HTML [ HyperText Markup Language ]
• The standard markup language for creating Web pages.
• Describes the structure of a Web page and how it is to be rendered
or displayed.
• Consists of a series of elements, tell the browser how to display the
content.
• It’s called a markup language, not a programming language.
Web browsers can read HTML files and render them into
visible or audible web pages.
• It is relatively easy to learn.
What is HTML?
HTML stands for HyperText Markup Language
HyperText
• The method by which we move around on the web — by
clicking on special text called hyperlinks which bring you
to the next page.
• Hyper means not linear — you can go to any web site on
the Internet by clicking on links, there is no set order to do
things in.
Markup
• What HTML tags do to the text. For example the use of a
specific Tag to mark up a text as italicised text.
Language Polytechnic Foundation Programme, Lecture 1B
FC AY22/23, Sem 2 Slide 5 Last updated 05/09/22
Official (Closed) - Non Sensitive
Every file with .html extension is usually opened by a web browser when you double-click
on it.
Polytechnic Foundation Programme, Lecture 1B
FC AY22/23, Sem 2 Slide 7 Last updated 05/09/22
Official (Closed) - Non Sensitive
Example Explained
<!DOCTYPE html> declaration defines that this
document is an HTML5 document
Text between <html> and </html> describes an
HTML document
Text between <head> and </head> provides
information about the document
Text between <title> and </title> provides a title
for the document
Text between <body> and </body> describes
the visible page content
Text between <h1> and </h1> describes a large
heading
Text between <p> and </p> describes a
paragraph
Ref: https://www.w3schools.com/html/html_intro.asp
HTML Elements
An HTML element is defined by a start tag, some content, and an end
tag:
<tagname>content goes here...</tagname>
Examples
<h1>My First Heading</h1>
<p>My first paragraph</p>
The 1st tag in a pair is the start tag <h1>, the 2nd tag is the end tag
</h1>. The end tag has a / before the tag name.
Start and end tags are also called opening tags and closing tags.
Some HTML elements have no content (like the <br> element which
defines a line break). These elements are called empty elements.
Empty elements do not have an end tag!
HTML Elements
HTML elements can be nested (elements can contain other
elements). Make sure you close the tags properly.
Example:
Correctly nested
<body>
<h1>My First Heading</h1>
<p>My first paragraph</p>
</body>
Incorrectly nested
<body>
<h1>My First Heading
</body>
</h1>
<p>My first paragraph
</p>
Note: use valid identifier for the section name – no blank space
Open in browser. Minimize the browser so that you will be able to see how
it moves from one section to another.
Polytechnic Foundation Programme, Lecture 1B
FC AY22/23, Sem 2 Slide 22 Last updated 05/09/22
Official (Closed) - Non Sensitive
HTML Images
Images are useful for making web pages more attractive
• Avoid too much text
• Avoid too many graphics
Use <img> tag to add image to the document:
<img src="myPicture.jpg">
The src attribute defines the image to be displayed.
Use the alt attribute to provide a text alternative. When the image is not
found
<img src="myPicture.jpg" alt="My Picture">
Images can be placed in <a> tags to form image links.
<a href="http://www.np.edu.sg">
<img src="nplogo.gif" alt="Ngee Ann Poly"></a>
Activities
Question 1
a. The tag that marks the beginning of a paragraph is .
b. The tag that marks the beginning of the highest-level heading is
.
c. The tag that marks the beginning of text that appears in the title
bar of a Web browser is .
d. The tag that creates a line break is .
e. The tag that marks the beginning of page contents that are visible
in the main window of a Web browser is .
f. The tag that marks the beginning of a Web page is .
g. The tag that marks the beginning of code that does not appear in
the main browser window is .
Polytechnic Foundation Programme, Lecture 1B
FC AY22/23, Sem 2 Slide 26 Last updated 05/09/22
Official (Closed) - Non Sensitive
Activities
Question 2
Question 3
Write the HTML codes to link a web page to www.google.com.sg
Activities
Question 4
Write the HTML codes for School of ICT web page to
display the following courses in the home page.
Question 5
Write the HTML codes to create the following list:
Reading Reference
http://www.w3schools.com/html/html_intro.asp
http://www.htmlprimer.com
http://www.w3schools.com/tags/default.asp
Summary