Thursday, July 3, 2008

HTML Basic Structure by Noel Dundas

 

Hyper Text Markup Language, or HTML for short, is the language of the Web, and every Web developer should have a basic understanding of it yet many do not know the differences between versions or the importance of adhering to proper coding guidelines.

In this article we will discuss the importance of choosing the right version, using correct coding and validation.

HTML 4.01
HTML 4.01 is an important Web standard and very different from HTML 3.2. When tags like <font> and color attributes were added to HTML 3.2, it started a developer's nightmare. Development of web sites where font information must be added to every single Web page is a long and expensive pain. With HTML 4.01 all formatting can be moved out of the HTML document and into a separate style sheet which, not only makes coding much simpler and clearer, can shorten the length of a page conserving bandwidth and speeding up the loading of the pages.

HTML 4.01 is also important because XHTML 1.0 (the latest HTML standard) is HTML 4.01 "reformulated" as an XML application. Using HTML 4.01 in your pages makes the future upgrade from HTML to XHTML a very simple process. Make sure you use the latest HTML 4.01 standard or, better yet, XHTML 1.0.

XHTML
XHTML 1.0 became a W3C Recommendation January 26, 2000. W3C defines XHTML as the latest version of HTML. XHTML will replace HTML. XHTML stands for EXtensible HyperText Markup Language XHTML is aimed to replace HTML XHTML is almost identical to HTML 4.01 XHTML is a stricter and cleaner version of HTML XHTML is HTML defined as an XML application.

When designing Web pages, try to use strict, formal and correct HTML (or XHTML). Strict and correct coding will always help a browser to display your pages as you intended them to look. If you elect for XHML, always validate it before publishing. XHTML is unforgiving, as we shall see later.

HTML 4.0.1 DOCUMENT DEFINITIONS.

There are 3 document type definitions in in HTML 4.0.1

The HTML 4.01 Strict DTD
Includes all elements and attributes that have not been depreciated or do not appear in frameset documents.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">

The HTML 4.01 Transitional DTD
Includes everything in the strict DTD plus depreciated elements and attributes (most of which concern visual presentation).
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">

HTML 4.0.1 Framesetbr> Includes everything in the transitional DTD plus frames as well. Use this when you want to use HTML Frames to partition the browser window into two or more frames.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN"
"http://www.w3.org/TR/html4/frameset.dtd">

You could be using HTML 4.0.1 now, but have you defined it as strict? Consider the following code.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>This is bad HTML</title>
<body>
<h1>Bad HTML
</body>

The two missing closure tags will be ignored by many browsers and the page will be displayed. However, if it was defined as STRICT, as below, the errors would become evident.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>This is bad HTML</title>
<body>
<h1>Bad HTML
</body>
Does this seem to indicate the exact opposite? Avoiding STRICT in favour of TRANSITIONAL? Far from it.

XHTML will replace HTML; there is no doubt about this, it is called evolution, and the sooner you change your pages, to at least HTML 4.0.1 strict, the less trouble it will be to convert to XHTML.

WHY USE XHTML?

Web developers are often struggling with time-consuming double-coding to solve problems with different browsers versions. This is not helped with the addition of new hardware (like mobile telephones and other hand held devices) and new software (like micro-browsers).

To make the Web a better place, for both developers and end-users, it is of paramount importance that both browser vendors and site developers follow standards when they develop new applications.

With its tremendous growth, the Web needs standards to realize its full potential. Web standards ensure that everyone has access to the same information.

Developers should not have to struggle with several versions of code to accomplish the same result. Does it make sense to limit your audience to only those with a particular browser? Standardization can increase the access to your site.

And lastly, a few words about often over-looked Issues.

USERS ARE SCANNERS.

Designing Web sites needs careful thinking and a lot of planning. The most important thing is to KNOW YOUR AUDIENCE.

If you believe a typical user will read the entire content of your Web pages, you are wrong. No matter how much useful information you put into a Web page, a visitor will only spend a few seconds scanning it before they decide whether to leave or to stay. On average, you have around 30 seconds; there is no loyalty.

If you want a visitor to read your text, be sure to make your point in the very first sentence of the page. After that you should try to keep them occupied with short paragraphs and interesting new headers all the way down the page

KEEP SENTENCES SHORT.

Try to keep your paragraphs as short as possible. Try to keep your chapters as short as possible. Try to keep your pages as short as possible. Less is often More to a reader searching for information so break it up.

Use a lot of space between your paragraphs and chapters; pages overloaded with text will kill your audience.

DON'T PLACE TOO MUCH CONTENT ON A PAGE.

If you have a lot to say, try to break your information into smaller chunks and place it on different pages. Don't expect any visitor to scroll all the way down to the bottom of a page with thousands of words.

VALIDATE YOUR CODE BEFORE PUBLISHING.

We have all been guilty of publishing without first validating our code. Many web page editors have a validation option built in, or there are several on-line code validation tools, so there really is no excuse.

http://validator.w3.org/ (free on-line HTML validator)

About the Author

Noel Dundas has been computing since the late 1960s and has written programs in assembly language, Forth, dBASE and web languages HTML, XHTML, XML, PHP and MySQL. Noel has also published several books, physical and electronic, and is the SEO for www.software4me.net and www.Ask-Noel.com

SiteProNews - Expert Articles

A FREE webmaster resource site, focusing on web site promotion, submission, positioning, and design.

SEO-News.com

A free newsletter & forum for web business owners about Search Engine Optimization.

Give Your Website
Top 10 Exposure

No comments: