Common HTML Problems

Problems when writing HTML

header spacer 2

Common problems found in HTML

When creating your pages, pay attention to the following common errors found on web pages.  First is your page document declarations. They may not seem too important to your goal of displaying your data, but web browsers are becoming more and more restrictive.  There are many different sources for building web pages now and the browsers must be able to identify how your page was created so that it can properly interpret it.  The following includes some common errors and corrections as well as some comment on the use of HTML and CSS.

Problem 1 - Defining your code in the page header

The first thing that a browser looks for when loading a page is the information in the header that defines the code that it must translate, i.e., HTML, XHTML or XML.  Almost all of our pages should be in HTML 4.0, although HTML 5.0 is available as well as XHTML.  All of my discussions will be about the use of HTML 4.0.  You have to tell the browser that your page is written in HTML 4.0.  I use the following "document type" statement at the beginning of my HTML 4.0 pages:

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


This tells the browsers that I created the page with HTML 4.0 Transitionsl in English and points to the w3.org (World Wide Web) definitions to validate the code in the page.
  The second statement required is placed in a "meta" tag inside the "head" of the page to define the content type (text/html) and the "character set" (utf-8) used in the page.  The one that I use is:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />


All "meta" tag declarations must be in the "head" portion of your page.  Since there is no "end tag" for a meta declaration, I always close the tag at the end with " />" because the newer versions of HTML will require all tags without a required closing tag to be closed in this manner.  This meta declaration tells the browser that I wrote the page HTML in a text format and used the character set "utf-8" (UCS Transformation Format—8-bit).  UTF-8 defines all the characters that can appear in your text document for the browsers and has become the dominant character encoding for the World Wide Web, accounting for more than half of all Web pages.


Previous Page Next Page