Moreover, at some point in the future it could happen that your code is notrecognized anymore, or produces an outcome different from what youintended.
[On the other hand, browsers will - in general - understand correct codefrom a previous version.]
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
and then submit it to a validation site.Here are the details.
- You have to describe the encoding used (some validating sitesguess it, or give you a choice).
One way is to do it before the HTML code. The next line takes care of thecommon choice of characters, ISO 8859-1, (Latin-1):
<?xml version="1.0" encoding="iso-8859-1"?>
Alternatively, add in the
<head>...</head>
part ofthe HTML code the line (note the use of quotation marks - it is not a typo)<meta http-equiv="Content-Type"content="text/html; charset=iso-8859-1">
- In order to validate your code, you have to declare thestandard to which it adheres.
To describe the HTML standard (the document type declaration,DTD), the file should contain a DOCTYPE declaration (before theHTML code).Here are a few examples (from http://www.htmlhelp.com/tools/validator/doctype.html).
The information about the URL against which to check the file need not beprovided.- HTML 4.01 Transitional:
or<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01Transitional//EN">
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
- HTML 4.1 Frameset:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN"
"http://www.w3.org/TR/html4/frameset.dtd">
- HTML 4.0 Strict:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN"
"http://www.w3.org/TR/REC-html40/strict.dtd">
- HTML 3.2:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2Final//ENC">
- HTML 4.01 Transitional:
- Then, you submit your file to a validator (either on the Internet, oron your machine.)
It can validate HTML and CSS1 (Cascading Style Sheets, version 1).
The CSS validator does not seem to like CSS included in an HTML file.
Help is also available.
The World Wide WebConsortium's validation site is http://validator.w3.org/.
This site offers validation of Cascading Style Sheets (CSS) as well.
To see what it does (and why), look at http://validator.w3.org/docs/help.html.