FIT3084: eXtensible HyperText Markup Language (XHTML)


In the previous lecture:

In this lecture:


Hyper Text Markup Language (HTML), a brief history

HTML is a document-layout and hyperlink specification language that was derived from Standrard Generalized Markup Language (SGML).

HTML consists of tags that specify:

w3c logo

Several versions of HTML were approved by the WWW Consortium (W3C) (see http://www.w3.org/ ).

The most recent approved version was HTML 4.01 (1999).

HTML 5 is in draft stage (since 2008). It has an XHTML variant (see below), XHTML 5.


Early HTML.

HTML was intended for specificying document structure, not for control of document graphic design & typography.

Originally the browser (on the client side) interpretted and displayed a (server provided) document's elements as it liked.

E.g. HTML allows the specification of a Heading level 2 but the client decides that a Heading level 2 shall be displayed in bold, 12pt Times Roman text (or otherwise).

So instead of...

Coke Logo a company's page might have looked like...

Coca-Cola
classic


®

...to some viewers. To please their marketing staff, companies made extensive use of images instead of plain text on websites. Text in images is not searchable, nor can it be read by text-to-speech software.


Later, Style Sheets and other tools allowed specification of exact fonts and colours, but...

...differences between the way browsers displayed and interpretted HTML made things tricky for designers.

Some browsers incorporated proprietary extensions to HTML...

...which did not work on other browsers (e.g. Microsoft Explorer & Netscape Navigator are two old browsers that had different "standards").


eXtensible HyperText Markup Language (XHTML)

valid XHTML XHTML may be checked for correctness automatically using a validation tool.

Tools for creating XHTML documents

For best results use one of the following:

For poor results, use:


You will also require:


XHTML tags

 


Sample XHTML document code

In the sample code that follows, for interest's sake, XHTML-specific tags are marked in blue. The remaining tags were also present in HTML although it was possible to get away with missing some of them out altogether.

<?xml version = "1.0" encoding = "utf-8"?>

<!DOCTYPE html PUBLIC "-//w3c//DTD XHMTL 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

<html xmlns = "http://www.w3.org/1999/xhtml">

<head>

<title> A silly, simple, sample page </title>

</head>

<body>

< !-- Document content goes here -->
<h2>A Grand Day</h2>
<p>
Oh what a <i>lovely</i> day <br /> for a walk!
</p>
<p>
Let's wander over to CEMA's <a href="http://www.csse.monash.edu.au/~cema">home page</a> and take a look!
</p>

</body>

</html>

The page produced by this code is available.


Some special tags

An XHTML document has two parts, a head and a body...

<a href="linked_to_doc_URL#anchor_name"> clickable elements go here </a>

<a name="anchor_name"> clickable elements go here </a>


Inline Images

The basic requirements for an image image tag are the source (src) attribute (a URL) of the image and some alternate (alt) text to display if images are turned off. (See these important notes on accessibility).

<img src="images/bug.GIF" alt="picture of bug" />

Additional attributes of the image tag may also be added. For example,

<img width="100" height="150" border="1" src="images/bug.GIF" align=left alt="picture of bug" />

<a href="bug.html"> <img src="bug.GIF" /> </a>

little bug

border=0

little bug

border=1

little bug

border=3


Image Maps

This is usually constructed using interactive software that lets you make standard shapes (ellipses, rectangles, polygons, circles) over an image and then export the XHTML code that corresponds to your drawing. The map drawing interface looks like this:

image map detail

The finished map looks and works like this:

fat bug thin bug

Click on the bugs above to see an image map in action!

(See these important notes on accessibility)


Ordered and Unordered Lists

<h4>Spot the odd one out</h4>
<ul>
<li>Tomatoes</li> <li>Potatoes</li> <ul>
<li>sweet</li>
<li>rotten</li> </ul>
<li>Elephantoes</li>
</ul>

Spot the odd one out

  • Tomatoes
  • Potatoes
    • sweet
    • rotten
  • Elephantoes



<h4>Spot the dog</h4>
 <ol> 
<li>Collar</li>
 <li>Cat</li>
 <li>Caterpillar</li>
</ol>

Spot the dog

  1. Collar
  2. Cat
  3. Caterpillar
 

Additional XHTML tags to research

Tables - very useful for laying out pages.

this is
a simple table

<table>
<tr>
<td>this</td>
<td>is</td>
</tr>

<tr>
<td>a simple</td>
<td>table</td>
</tr>
</table>

Forms - useful to obtain data from users


I'm a radio button
I'm a radio button too


Formatting and other tags

Tags such as <br />, <hr />, <span>, <div> & <meta> are all handy to know about, as are many others... do some reading to find out what tags are available. Some of them will be touched upon in later lectures.

Web References:


Other important tools used to create web pages

  PHP - a programming language embedded in XHTML documents that is executed (web) server-side before delivery to the client. Excellent for accessing server databases etc.
  Perl and CGI (Common Gateway Interface) - A general purpose scripting language that runs server-side to process requests received via a specifically-designed interface (CGI)
  JavaScript - a programming language embedded in XHTML documents and executed (web browser) client-side to make dynamic web pages
flash Flash - a proprietry (Adobe) authoring tool and browser plugin for making interactive animations, buttons, text and sound
java Servlets, JavaServer Pages (JSP), JavaServer Faces (JSF) - means of using the Java programming language to handle requests to complete computations, access databases, process forms etc.
.net Active Server Pages .NET (ASP.NET) - Microsoft's framework for doing what JSP does with Java by using Microsoft's .NET variants of the standard programming languages
ruby Ruby - an object-oriented, interpretted scripting language. This language works with the Rails Web Development framework (see below).
rails Rails - correctly called Ruby on Rails, this is used with Ruby for web applications that access databases.
ajax Ajax - Asynchronous, Javascript + XML, a powerful way of increasing the interactive speed of web pages that involves rethinking the way web documents are requested, sent and interacted with. Interaction between browser and server is asynchronous: a user does not need to wait for a full page to be received before interacting with the browser. Documents returned by the server are often only a small part of the entire requested document, thereby speeding up the interaction between client and server.

We will look at (several) of these technologies in more detail during the rest of this unit. In the meantime, do some reading to find out a little more about each of them.



This lecture's key point(s):


Courseware | Lecture notes

©Copyright Alan Dorin 2009