D. More About Tags
1. Tags are XML markup

So far we have used tags that have a simple form <tag>.

In XML terms, each tag represents an "element". Elements can (but don't have to) have "attributes" defined for them, that give more information about the element.

Many HTML tags take optional attributes.

Example:
<img src="myImage.jpg" width="300" height="200" />
  |                |                 |                                element        attribute value   attribute name
name            (in quotes)
2. Making Links

Links are what the web are all about...

"Relative links": to a page that is on your file system somewhere. Use them if you can. They save network resresources and make you text portable.

Examples

<a href="myLink.html">A link to a document in the same directory as this file</a>

<a href="myDirectory/myLink.html">A link to a document in a subdirectory of this file</a>

<a href="../myLink.html">A link to a document in the parent directory as this file</a>
Full link example:
<a href="http://mediaartprojects.org.uk/links.html>This is a link to an external web page</a>
You can link to a specific place within your document with an "anchor"
<a href="#AnchorName>This will be a link</a>

To a place in the same document that you have marked up with a tag like this:

<a name="AnchorName>Link will take you here</a>
3. Adding Images

The syntax is similar to making links, except that that the element is "empty", ie. it does not surround any text.

Example

<img src="myImage.jpg" width="300" height="200" alt="image of me" />

Note that these last two are useful, but are "deprecated" from the standard in favour of stylesheets.

Try making images links

4. Adding Tables

The display of HTML is very difficult to control, and so tables are very often used for layout. This is thought of as bad practice these days however when stylesheets can usually do the job much better. However, because of incompatibility between how browsers handle stylesheets, and for other reasons, you very often find yourself using tables.

Example

<table width="75%" border="1" bgcolor="#ffff66" align="center">
    <tr>
        <td>First you need to define a row</td>
        <td>Within each row you define a cell with the <td> tag</td>
    </tr>
    <tr>
        <td>You may define the width of the table</td>
        <td>as percentages or actual numbers of pixels</td>
    </tr>
</table>

And that code will look like this in a browser:

First you need to define a row Within each row you define a cell with the <td> tag
You may define the width of the table as percentages or actual numbers of pixels

Its best to have a really good idea of what you want your table to look like before you start!

Further Reading
Relevant sections in Castro and Shelley
http://www.w3schools.com/html/html_examples.asp
http://www.w3schools.com/xhtml/default.asp
http://www.cookwood.com/html/extras/xhtml_ref.html

Next: Stylesheets