Full HTML Guide
Full HTML Guide
1
MARK-UP LANGUAGES
Traditionally used to provide typesetting
information to printers where text should be
indented, margin sizes, bold text, special font
sizes and styles, etc.
Word processors like MS Word, and typesetting
systems like LaTex are also forms of mark-up
languages.
Rich Text Format (rtf) files are written in a
mark-up text format.
2
HYPERTEXT MARKUP LANGUAGE ( HTML )
describes the structure of the document
has
evolved to version 4.01.
www.w3.org
3
WEB BROWSER
Software when connected to the Internet is able
to access documents at remote locations and
display them locally in accordance with its
interpretation of markup instructions in the
document.
4
HTML DOCUMENTS
Plain text files, with extension htm or html.
The extension tells the browser interpret the file
according to HTML standards.
Browsers may display other types of files as well,
according to the file’s extension.
TXT - .txt - plain text file, no formatting.
PDF - . portable document format (Adobe corporation)
JPG - .jpg - JPEG image file.
5
HTML DOCUMENTS
No special software is needed; you may use any
plain text editor to create html files manually.
Mac Users:
TextEdit is all you need but since it is by default a
RTF editor, it must be configured to the plain text
mode in Preferences.
Textwrangler is one example of a nice alternative for
novice users who is not so comfortable with file
7
format.
A WORD OF CAUTION:
No matter which editor you use, if it is not
strictly plain text, some characters may cause
display errors.
9
CASE RESTRICTIONS
Technically, HTML is not case-sensitive (case-
insensitive), meaning that either upper or lower
case may be used in tags and the browser will not
care.
*See their proper application in the "testpage.html" example in the next slide.
11
TEMPLATE
*Use the codes below to begin constructing your assignment document.
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
<title>***replace this text with course & section number and your full name
</title>
</head>
<body>
<!--Begin your content specification by adding your elements here. -->
</body>
12
</html>
BASIC HTML DOCUMENT STRUCTURE
Html document consists of the head and the body.
The head contents are used by the browser/system.
The body elements are rendered (displayed) by the browser.
<body>
{ Main content here }
</body>
</html> 13
THE HEAD (HEADER) SECTION
</title>
</body>
15
BODY ELEMENTS
html documents consist of a number of elements
where text is placed in containers with a open/begin
tag and an close/end tag (tandem tags)
Invalid:
<p>This overlap is not <em> nested. </p> So it is invalid. </em>
Valid:
<p>This is correct <em>nesting.</em> It is valid.</p>
17
TEXT ELEMENT TAGS
18
PRESET FORMAT
</blockquote>
19
LISTS: NUMBERED OR BULLETED
{Begin an Ordered List – numbered}
<ol>
<li> … </li> {1st list element}
<li> … </li> {2nd list element}
</ol> {End of Ordered List}
<! This is a comment line: you may place it anywhere in your document; the browser will ignore it.>
<title> HTML document example</title>
</head>
<body>
<h3> This be a heading level 3</h3>
<p>This is a sentence in this document.</p>
<p>This is another sentence.</p>
<blockquote> <! The list below will be indented.>
<ol>
<li> First list item</li>
<li> Second list item</li>
<li> Third list item</li>
</ol>
</blockquote>
</body>
</html>
21
THE ANCHOR ELEMENT
The anchor element, the tag name, single
letter a, is used to connect or link different
documents or parts of one document.
22
HYPERTEXT LINKS
Anchor tag is used to create a link that jumps
from one point in a document to another
destination (target location).
23
GENERAL FORM:
24
EXAMPLE A (EXTERNAL):
<a href = "http://www.yorku.ca">York University</a>
25
EXAMPLE B (LOCAL):
<a href = "faves.html">My Favourite Things </a>
Attributes:
src = "filename…. ": Identifies the file to be
loaded into a document.
align = "top", (or "middle", "bottom", "left", or
"right") positions the image in the document
30
E.G. 1
<img src="../pix/selfie01.jpg">
32
E.G. 3
<img src = "/graphics/redbaloon.bmp" align =
"middle" height = "100" width = "200">
35
TABLES
Row 1
Row 2
Row 3
36
TABLES
37
TABLES
<td><center><b> … </b></center></td>
39
Table Format [ 3 columns x 2 Rows ]
<table>
<tr>
<th> Row Header </th> <td> Data </td> <td> Data </td> </tr>
<tr> <td> Data </td> <td> Data </td> <td> Data </td> </tr>
</table>
40
< th > and <td> Attributes:
colspan = "x" : Forces the cell to cover "x" number of columns. Default = 1.
E.G. < td colspan = "3" > . . . </td>
rowspan = "y" : Forces the cell to cover "y" number of rows. Default = 1.
font whatever = ( as desired ) : font attribute such as color, size, family, etc.
41
Other Table Options:
<thead> … </thead>
• Defines a header section. Contains <tr> elements.
• If used, it MUST precede a
<tbody> … </tbody>
• which contains the usual table rows, and this should be
followed by a footer.
<tfoot> … </tfoot>
42
More Table Format [ 3 columns x 2 Rows ]
<table>
<thead>
<tr> <th colspan = "3" align = "center"> Header </th> </tr>
</thead>
<tbody>
<tr> <th> Row Header </th> <td> Data </td> <td> Data </td> </tr>
<tr> <td> Data </td> <td> Data </td> <td> Data </td> <tr>
</tbody>
<tfoot>
<tr> <th colspan = "3" align = "center"> Footer </th> </tr>
</tfoot>
</table>
43
More Example Specifications
44
Table cells may contain many different
ordinary HTML containers, making them
quite versatile as aids in layout and design.
Including:
• Images
• Hypertext Links
• Lengthy Text
• Other tables
• Also, Applets & Objects
45
Table-in-a-table example:
<table>
<tr> <td>
<table>
<tr> <td> <img src = "somepicture.jpg"></td></tr>
<tr> <td><a href = "targetURL">Click ME!</td></tr>
</table>
</td></tr>
</table>
46
Mailto: – Linking to your E-mail client
47
Validating HTML Codes
• HTML 4.01 is the last standard version.
49
• If, instead, you see the Nu Html Checker page below, your
document is faulty.
51
• Once your document is error-free, you will see this page
with a green banner.
52
• Copy-paste the codes as the last element of your document;
save the updated version.
• You may of course validate your CSS also but it is optional for
your assignment.
53
The index.html file