HTML
HTML
Introduction to HTML
HTML Hello.html
Hello.html page
page asas
HTML code
code written
written using
using
Notepad. interpreted by the web
interpreted by the web
Notepad. ItIt isis saved
saved as
as
“hello.html” browser.
browser. Eg:
Eg: Internet
Internet
“hello.html”
Explorer
Explorer
Hello.html is indicated in web
browser file
HTML
HTML documents are text files made up of
HTML elements.
HTML elements are defined using HTML tags.
HTML Tags
HTML tags are surrounded by angle brackets, < and
>
HTML tags usually come in pairs like <p> which is
the start tag and </p> which is the end tag.
You will write the element content between the
two tags.
HTML tags are not case sensitive. <p> will be
treated as <P>.
HTML TAGS
“hello.html” has five HTML tags:
<html>
<head>
<title>
<body>
<h1>
The highest hierarchy is <html>. <html> tags has a few child tags such as
<head> and <body>.
Child tags must be placed inside the parent tag. As you see <title> is
placed inside the <head> tag.
<body> tags can contains most of other tags such as <h1>, <table>, <p>,
and many more.
Inside <title>… </title> you can write any text as a title of home page.
The purpose of the <body> tag is to define the HTML element that
contains the body of the HTML document.
HTML BASIC TAGS
<body>…</body>
<body bgcolor = “colorname”> - default color
is white
<body background = “image.gif/.png/.jpg”>
The image must be located in the same
location as the HTML file.
Image file named ‘cat’ is located
on the desktop. This is a JPEG
file, its extension is .jpg.
<body background="cat.jpg">
Small image will be
tiled to fit the
browser window size
A large image will fit
nicely in the
browser window size
<body
background="catbg.gif">
OTHER TAGS
Headings
For header of a page, to indicate title
<h1> … <h6>
Eg: <h1>Welcome</h1>
Paragraph
<p>Welcome to my homepage</p>
Line break
<br>
Comment
Welcome to my homepage
<pre>… </pre>
To preserve the appearance of information
<pre>
Name : Hana
Course: Computing
</pre>
<blockquote>… </blockquote>
Used to indicate quotation
OTHER TAGS
<hr> Horizontal line
width, size, align
Eg: <hr size= “3”> <hr width=“50%”>
<hr align = “right”>
<hr size=“3” align=“left”>
<body bgcolor="yellow">
<h1>Hello</h1>
Welcome to my homepage
<br>
<img src="cat.jpg">
</body>
</html>
EXERCISES
Write the code to produce this page:
ANSWER
<html>
<head><title>Exercise</title>
</head>
<body>
<img src = "fblogo.jpg">
</img>
</body>
</html>
EXERCISES
<html>
<head><title>Exercise</title>
</head>
<body>
<img src = "fblogo.jpg"
align="right">
</img>
</body>
</html>