Skip Navigation

www.wimb.net - XHTML



XHTML

On this page:

The HTML story does look not so very difficult. You will find this type of html on many web sites. But, it is old. Now there is a new standard, xhtml.

One of the differences is the DOCTYPE declaration. This must be on the first line. The rest looks more or less the same as in the previous html example, but, as you can see, no more uppercase, all tags must be in lowercase.

Example 2

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title>simple document</title>
</head>
<body>
<p>a simple paragraph</p>
</body>
</html>

Click here to view example 2

In XHTML the tags are more strict then in HTML. XHTML is more or less XML using HTML tags. It demands a lot more precision from the person using it. Currently, only a few tools exist for XHTML. Most people designing web documents with XHTML are hand coding. For example all tags must be in lowercase and all attribute values must be enclosed in quotes. The very best is to learn only the new XHTML tags and not the old HTML style tags.


Some XHTML tags:

Links
With links you can go from one page to another, or to a page on another site.

<a href="example2.html">Example2</a>

The text "Example2" is visible in the browser and when you click on it, you go to the file " example2.html" Example 6 with two links.


High-Tech Logo

Images
brings something extra on your pages. The img tag can be used for that.

There are many image formats, but the most used are jpg, gif and png. Make sure that the image file size is as small as possible, use the correct dimensions, compression etc.

<img src="sec_site/htlogo.gif" alt="High-Tech Logo" title="High-Tech Logo" height="95" width="95"/>

The "alt" attribute must describe the image while a "title" attribute can be used to place extra information on a page. This works like a "tooltip" Normally it is hidden, but when the mouse pointer comes on it, a small text appears in a box. The title attribute can be used in many tags, like for images and for links. Put your mouse on the link: Example2

More XHTML

Also for XHTML there is a good course on w3schools.com

Another imported difference between HTML and XHTML is the (not) use of the "markup" attributes. In example 1 there was a line like: <body bgcolor="yellow"> In XHTML this is not allowed.

Of course, you can give the body any color you want, but you have to use CSS.

PID: 7011 CLT: 0.001 LMD: 2013-Aug-17

Updated 2007 Oct. 09