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.
Common problems in Web Design labs
Files names
Files
with incorrect file names (labs have specified file names)
If you have not set your computer correctly, as shown in the Orientation, FAQ, and the top of the practice web page, you may wind up with files named
page1.htm.htm instead of
page1.htm
because your computer is hiding part of the filename.
My notes also say not to use upper case letters or spaces in filenames.
Zip
You are not zipping files, or are complaining the zip breaks the file
How to zip is included on the lab web site, and at http://www.templejc.edu/prodev/media/zip/zip.html
A zipped page does not function correctly until I unzip it.
Spaces between quotation marks
You cannot put extra space within quotation marks...
"white " is not the same as
"white"