What's HTML4 all about?

HTML4 is the latest standard released by the World Wide Web consortium (www.w3.org) for web pages. Making sure that your pages comply with standards like HTML4 will allow your site to be viewed by the maximum number of visitors. Since HTML4 was published, browsers have moved on and support for HTML4 is becoming much more consistent between updated browsers. Previous versions of codehelp.co.uk had to provide variations within the HTML4 standard because not all visitors had upgraded their browsers to the latest versions (notably upgrading from Netscape4 and IE4). Changes in browser support have led to a significant change in site design for many sites, including CodeHelp. Code should now be written to fit the HTML4 standard without concerns about browser bugs or extensive testing on multiple browsers / platforms. Write your HTML4 + CSS, check the code and maybe just test the appearance in two browsers.

HTML4 is the first version to include cascading style sheets as part of the HTML standard - HTML4 is now reliant on style sheets to provide precise control of data within the page. HTML4 also makes the issue of deprecated tags much more important. As browsers continue to develop and later versions of HTML are published, deprecated tags and attributes will be dropped from browser support - pages relying on them will simply fail to work. It is all part of a move away from ad-hoc development of HTML (led by the browser designers) as with HTML3 to an organised and structured development that all browsers follow consistently. To achieve the transition, the W3C provide three versions of HTML4 - transitional, frameset and strict. The intention is for sites to move first to transitional (using frameset for pages that still use frames) and on to strict in time. (Strict requires the removal of all deprecated tags and attributes for validation). Achieving transitional validation is all about good coding practice. Tags must be nested properly and all end tags must be present.

Use one of the following definitions as the first line of all HTML files to tell the browser to use HTML4 conventions:

Transitional

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html><head>

Frameset

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN"
"http://www.w3.org/TR/html4/frameset.dtd">
<html><head>

Strict

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html><head>

XHTML

XHTML is often output from translations of XML files and is simply HTML with extra syntax rules. e.g. <br> doesn't have an empty tag in HTML, so just as in XML, it needs to be declared as empty in XHTML: <br />. Another tag that can catch you out in XHTML is meta - make sure each meta tag ends in /> not just >. All tags in XHTML must be nested correctly and all end tags must be used. Note also the namespace and language attributes of the html tag.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
 "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">


This is part of www.codehelp.co.uk Copyright © 1998-2004 Neil Williams
See the file about.html for copying conditions.