(X)HTML Introduction

HTML and XHTML – or (X)HTML, when referring to both – are used to create the structure of a Web site; this is always the first thing to be coded. Following correct coding standards is the first step in accessible Web design.


HTML 4.0 vs. XHTML 1.0

All of the arguments and counterarguments boil down to two simple ideas: 1) What is needed for the site, and 2) The designer's personal preference.

Some say HTML allows the use of "sloppy" coding practices, which is true only if designers behave lazily and don't validate their code to catch their mistakes. As long as the designer is willing to code correctly and have his/her code validated, it won't be sloppy. Learning the correct coding practices in the first place makes HTML just as good a tool as XHTML.

Another potential problem is that, in order for browsers to understand XHTML, the code has to be sent from the server as HTML instead. Designers hoped browsers would eventually be able to read and understand XHTML; but this has not happened yet. Still, many proponents suggest that XHTML should be used anyway, so that when browsers are eventually able to read and understand XHTML, the sites will be ready for it and won't require major redesign or overhaul to update the markup.

In short, large companies, governments and other organizations that require large or extensive sites should probably be created with XHTML. This way, the site is designed with the ability to expand where needed quickly. Smaller companies and personal sites usually don't need XML technologies and can, therefore, be created with HTML. In either case, it is a good idea to learn how to use both (and understand their basic differences) in order to be able to easily switch between the two when needed.

It's almost like the difference between having a hammer and a nail gun – both will put a nail in a wall. It's easier to be sloppy with a hammer but if the person doing it pays attention and is careful, it doesn't need to be sloppy. Just because you have a new, "better" method doesn't mean the old one is useless or no longer needed. There will be times when a hammer is a better choice than a nail gun, and vice versa.


Document Types

Transitional was always meant to be used when transitioning from pre-HTML 4.0 markup to modern markup. Older, already-established sites could be switched to XHTML without the need for a complete redesign. When creating a brand new site from scratch, this DocType should never be used.

Frameset is used only for sites that use frames. Frames are deprecated by the World Wide Web Consortium (W3C) and should never be used unless absolutely necessary.

Strict is the best document type to use for all sites. Not only does it require better coding practices, it emphasizes the separation of content (HTML/XHTML) from presentation (CSS) and behaviors (JavaScript).

Site Content

Before creating the site, it's important to consider the text that will be included. Make sure the text will be easy to read by as wide an audience as possible. Don't use jargon or slang that could be confusing to the average reader. Next, be sure to break up the text into logical sections. Pages should contain different topics – Home page, About page, Contact page, etc. Content within a page should be broken up with appropriate headers. The layout should always be the same for every page on the site. For example: header on top, main navigation links to the left and content to the right. Finally, only structure tags should be used in the HTML document. CSS and JavaScript elements should always be contained in separate files.