R. Craig Collins >Common
> How To: Check for errors in HTML
How To: Check for errors in HTML ©
R. Craig Collins, 2005
- Make sure you are starting with
<html>
<head>
<title>
</title>
</head>
<body>
</body>
</html>
- You only use <body> </body> once,
and all the items to display in the main browser window go
in between.
- When constructing a web page in HTML, it is important to build up your page
one item at a time; not all at once, and not in a linear fashion. That is,
don't start typing from start to finish, then look at the browser.
- If you put in a less than sign to start making a tag, you should immediately
put in the the greater than sign.
< >
- If you have a beginning tag that is used to change the appearance of
text, you should immediately put in the ending tag.
< > </ >
- If the tag requires an attribute, make sure there is a space after the
tag before you place the attribute, and type in the = followed immediately
by TWO quotation marks " ".
No space between attribute and the =
<tag attribute="">
</tag>
- Insert the attribute value between the "
and ", no spaces.
<tag attribute="value">
</tag>
- Insert the text that the tag/attribute will format, between the tags.
<tag attribute="value">Text</tag>
- TEST JUST THIS CODE in your browser.
- If you wish to add additional attributes, add them one at a time, testing
the code in between.
- SUMMARY: Most errors on a web page are due to missing one of
these matched elements
< and >;
< > and </
>; =" and "
- Be careful spelling; if copying something, make sure it is plain text and don't use word processors.
- " is not the same as ” (plain quotation marks, not curly quotation marks)
- a href is not the same as a
herf
- a href="pagetwo.htm" will not find a document named page-two.htm
- Separate components with a space
<tag attribute="value" attribute="value"
attribute="value">
</tag>
- When looking at a web page's code, the error is almost always above where
it starts to look wrong in the browser. A bug chunk of a web page will disappear
if you miss a " earlier in your code.
- You only use <body> </body> once,
and all the items to display in the main browser window go
in between.
- Many times you have compound mistakes (if you don't add a piece at a time,
as recommended)... fix them one at a time, and test the code before moving
on.