HTML
HTML
<p> Swimming is my most favorite activity in the summer. When the sun is shining and the air is warm, you will find me dipping into
my backyard pool. It’s not an impressive pool, only three feet deep, but it’s mine.</p>
•<ul>
<li>I get lots of exercise</li>
<li>I enjoy the freedom</li>
<li>I have an opportunity to be in the sun.</li>
</ul>
</body>
</html>
Viewing the hidden code!
Go to View on the toolbar and then click on Source for Explorer or Page
Source for Navigator.
• Basic Concepts
• The tools you need
HTML is written in plain text. All you need is a simple text-editor. For
MACs, that would be SimpleText and for Windows, Notepad.
• Some rules
HTML tags are always surrounded by what are called angle brackets < and
>.
• Elements
The words/letters between these two angle brackets are called
elements. These are the coded commands within HTML. Elements
tell the browser how to display the web page.
• For example: <hr> tells the browser to display a horizontal rule;
<br> tells the browser to skip a line.
Cont…
•
• Primary Tags
• To build any web page you will need four primary tags: <html>, <head>, <title>
and <body>. These are all container tags and must appear as pairs with a
beginning and an ending. <html>…</html>
• Every HTML document begins and ends with the </html> tag. This tells the
browser that the following document is an html file. Remember, tags tell the
browsers how to display information.
• <head>…</head>
• The <head> tag contains the title of the document along with general
information about the file, like the author, copyright, keywords and/or a
description of what appears on the page.
• <title>…</title>
• Appears within the <head> tag and gives the title of the page. Try to make your
titles descriptive, but not more than 20 words in length. The title appears at the
very top of the browser page on the title bar.
• <body>…</body>
• The main content of your page is placed within the body tags: your text,
images, links, tables and so on.
• Creating your first web page
• Using the primary HTML tags, to create your first Web page. Step 1 Open
up a text editor (SimpleText for Mac or Notepad for Windows)
• <ol>…</ol>
The ordered list is a container tag and is used for numbered lists.
• <ul>…</ul>
The unordered list is a container tag and is used for bulleted lists.
• <li>…</li>
The listed item tag is a container tag and is nested within the
ordered or unordered tags.
• Here is an example of the differences between ordered and
unordered lists.
• An ordered (numbered) list :
• <ol>
<li>My first item on the list.</li>
<li>My second item on the list.</li>
<li>My third item on the list.</li>
<li>My fourth item on the list.</li>
</ol>
• <html>
<head>
<title>This is my first web page.</title>
</head>
<body>
<h1>Hello world.</h1> This is my first web page. There's more
to come.
• <hr>
<p>
I am learning how to use the horizontal rule, headline,
paragraph and line break tags. Writing HTML isn't as hard as it
appears.
</p>
• <body bgcolor="#bee3c2">...</body>
• <html>
<head>
<title>My Spring VacationII</title>
</head>
<body bgcolor="#e3f04a" text="#000000">
<h4 align="center">My Spring Vacation<br> by Russ
Peabody</h4>
<hr align="center" width="40%">
</body>
</html>
• <html>
<head>
<title>This is my first web page.</title>
</head>
• <body bgcolor="#ffff00" text="#000000">
<h1 align="center">Hello world.</h1>
<p align="right"><b>This is my first web page. There's more to come.</b> <hr align="center"
width="50%">
<p>
I am learning how to use the horizontal rule, headline, paragraph and line break tags. Writing HTML isn't as
hard as it appears.
</p>
</body>
</html>
Advanced text formatting
• <html>
<head>
<title> This is a page using tables </title>
</head>
<body bgcolor="#ffffff" text="#000000">
<h1>A Web Page Using Tables</h1>
<table border="1">
<tr>
<td bgcolor="#000000">
<font color="#ffffff">
<b>This is column one</b>
<br>
I enjoy working on HTML code. It gives me a chance to be creative.</font>
</td>
• <td bgcolor="#bee3c2"> <b>This is column two</b></td>
<td bgcolor="#ff8000">
<font color="#804000">
<b>This is column three<br>Notice what happens to the column when you add copy. It gets larger. This can cause
a problem. But we do have a way to control the margins in tables.</b>
</font>
</td>
</tr>
</table>
</body>
</html>
Control table width by percentages
• <html>
<head>
<title> This is a page using tables </title>
</head>
<body bgcolor="#ffffff" text="#000000">
<h1>A Web Page Using Tables<h1>
<table border="1" width="100%">
<tr>
</tr>
</table>
</body>
</html>
A table with multiple rows and columns/cells
• <html>
<head>
<title> Rows </title>
</head>
<body>
<h1>Here's a table with two rows</h1>
<table border="1">
<tr>
<td>This is column one</td>
<td>This is column two</td>
</tr>
<tr>
<td>This is column A</td>
<td>This is column B</td>
</tr>
</table>
</body>
</html>
Column/cell tag and its attributes
• <html>
<head>
<title> Alignment Attributes </title>
</head>
<body>
<h1>Here are some examples of alignment</h1>
<table border="1" width="100%">
<tr>
<td bgcolor="#ff0000" width="40%" align="right">
This is column one<br>
This is column one<br>
This is column one<br>
This is column one<br>
</td>
<td width="60%">
This is column two<br>
This is column two<br>
This is column two<br>
This is column two<br>
</td>
</tr>
<tr>
<td bgcolor="#ffff00" width="40%" align="center">
This is column A<br>
This is column A<br>
This is column A<br>
This is column A<br>
This is column A<br>
This is column A<br>
</td>
<td bgcolor="#0000ff" width="60" valign="bottom">
<font color="#FFFFFF">
This is column b<br>
This is column b<br>
This is column b<br>
</font>
</td>
</tr>
</table>
</body>
Spanning rows and columns
• When creating a table and you want to expand a column or a row you use the following attributes:
• colspan: expands across a number of columns
• rowspan: expands across a number of rows
• <html>
<head>
<title> Rowspan and Colspan </title>
</head>
<body>
<h1>Here's a table demonstrating rowspan and colspan</h1>
<table border="1">
<tr>
<td rowspan="2">This is an example of rowspan. It is spanning two rows.</td>
<td>This is column B</td>
<td>This is column C</td>
</tr>
<tr>
<td>This is column D</td>
<td>This is column E</td>
</tr>
<tr>
<td colspan="3">This is an example of colspan. It is spanning three columns.</td>
</tr>
</table>
</body>
</html>
Image
• <img src="masks.jpg" width="149"
height="140" alt="You can determine how
large your images are by opening them in
Navigator.">
• <img src="masks.jpg" align="right"
width="149" height="140" alt="This is an
example of a right-aligned image.">