Objectives of The Lab:: IEEM 230. HTML Basics
Objectives of The Lab:: IEEM 230. HTML Basics
HTML Basics
Learn basic HTML language, and be able to write HTML documents using a text editor.
- simple formatting
- lists
- controlled layouts using tables
- images
- links and URL’s
Reference:
Simple HTML documents contain two things: (1) the text, and (2) information about how the text
should be formatted (called TAG’s).
The TAG’s provided in the following HTML example file will be sufficient for the purpose of
this lab. To make it easier to read, all TAG’s are red, and comments are in blue.
<html>
<!-- this is a comment. Each HTML file begins with an “html” tag, and ends with a “/html” tag>
<!-- html documents have two sections: “head” and “body”>
<head>
<title> IEEM 230: basic html tags
</title>
<!—title is what appears on the title bar of the window >
</head>
<body>
<p>
<b> IEEM 230 Lab 1: Simple HTML reference </b>
<p>
<hr>
<b> <i> Simple formatting tags </i> </b>
<p>
<!-- the “b” and “/b” tags enclose bold face text >
<!-- the “i” and “/i” tags enclose text in italics >
<!-- the “br” tag causes a line break (the following text is printed on a new line)>
<!-- the “p” and “/p” tags enclose each paragraph>
<font size=+1 color=red> The “font” tag </font> can control the size and color of text. It has
two useful options: size=+N (N is an integer) will increase or decrease the size of text to the N-th
larger font size; size=-N will decrease font size. The color=C changes the color of the text.
HTML recognizes all common color names, or you can specify the RGB value of the color in
Hexadecimal.
<p>
<hr>
<p>
<b> <i> Controlling the layout of text in a page </i> </b>
<p>
<b> 1. Horizontal bars. </b> To break a page into sections, create a horizontal bar using the
“hr” tag.
<p>
<b>2. Lists of items. </b> You can create a list of items using the following.
<!-- the “ol” and “/ol” tags enclose an ordered, or numbered list of items >
<!-- the “li” and “/li” tags enclose each list-item>
<!-- the “ul” and “/ul” tags enclose an un-ordered, or bullet list of items >
<!-- “li” and”/li” enclose each list-item>
<p>
<!-- below is an example of a numbered list with two items>
<ol>
<li> First item in an ordered list. </li>
<li> Second item in a ordered list </li>
</ol>
<br>
<!-- below is an example of a bullet list with two items>
<ul>
<li> One item in an unordered list </li>
<li> Another item in the unordered list </li>
</ul>
<p>
<b>3. Tables. </b>Often you will need to display items in a table. To do so, use a “table” tag.
Another common use of tables is to divide the entire page into a few segments, with each segment
having its own data to display. A table is made of rows, and each row has one or more columns,
or cols.
<p>
<b>Example of a table:</b> <br>
<tr>
<td> First col of Second row </td>
<td> Second col of Second row </td>
<tr>
</table >
You can experiment with different values for “border=N” and “cellspacing=N”.
<p>
<hr>
<p>
<b> <i> Commonly used links </i> </b>
<p>
<ul>
<li> Link to another document: “a href=URL” Text of the link “/a” <br>
Example: <a href=http://www.ust.hk/itsc/webguide/reference/html-tools.html>
ITSC web-page building guide
</a>
</li>
<p>
The URL,(Universal Resource Locator) is the <b> <i>name and location </b> </i> (on the
internet) of the linked file. Its format is: http://computer_name/full_path_name_of_file. The URL
of a link is also displayed by the web client, e.g. Internet explorer shows it as the “Location:”
URL can be absolute (e.g. the first item in the list above), or relative to the location of the current
file (e.g. the “img src=shark.jpg” example in the list above).
<p>
<hr>
<p>
<!-- Each html file ends with the closing of the “body” and the “html” tags.>
</body>
</html>
The function of the internet requires at least two programs: A web client (e.g. Internet Explorer),
and a web server (e.g. Apache, or Microsoft IIS). The server program is always running on a
computer which is also called your web-server.
web client
4. Web client
(i) Receives and displays contents of index.html
Exercises:
(i) Save the image (use mouse-right-click on the image) on the Desktop, with filename: shark.jpg
2. Start PHP Designer 2005 software. Choose ‘HTML’. Copy and paste the HTML text in this
lab-sheet (all text between the “html” and “/html” tags above). Save as lab1q1.html to the
Desktop. Open the file using Internet explorer.
3. (i) Create your own web-page with (at least) the following
- one image
- one table
- one mailto
- one URL linking to another web-page in UST.
(ii) Load the page to your iHome account, into a folder called “ie230” and in a file called
“lab1.html”
[Notes: you will also need to upload the image file]