Forum Moderators: open

Message Too Old, No Replies

Confused about validation errors

         

John_Caius

3:57 pm on Aug 25, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I'm trying to validate some new HTML using the W3 HTML validator. However, I've got some errors and I don't know what I've done wrong.

My HTML file looks like this:


<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>

<head>
<title>My Site</title>
<link rel="stylesheet" type="text/css" href="styles.css" />
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1" />
</head>

<body>

content

</body>
</HTML>

I get three HTML validation errors that I don't know how to correct.

1) document type does not allow element "META" here
- referring to the slash at the end of the meta http-equiv tag

2) end tag for element "HEAD" which is not open
- referring to the </head> tag

3) document type does not allow element "BODY" here
- referring to the <body> tag

Any ideas? Thanks. :)

victor

4:13 pm on Aug 25, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Try with a recognised DOCTYPE (they are case sensitive): (watch for line breaks if cut'n'pasting)

<!DOCTYPE HTML PUBLIC
"-//W3C//DTD HTML 4.0 Transitional//EN"
"http://www.w3.org/TR/REC-tml40/loose.dtd">

John_Caius

5:05 pm on Aug 25, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



No, that makes no difference (I got rid of the line breaks). :(

korkus2000

5:09 pm on Aug 25, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



It looks like you have one error up there that is forcing the other errors. Try making html tag lowercase and put you link under the meta. Do you have any strange characters in your title?

claus

5:13 pm on Aug 25, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I think it might be the space+backslashes, i don't think they should be there, that's an XML-thing:

<link rel="stylesheet" type="text/css" href="styles.css" />

One more; try a blank line after the DOCTYPE, before <html> and make the meta "content-type" the first (before the stylesheet).

/claus

[edited by: claus at 5:17 pm (utc) on Aug. 25, 2003]

John_Caius

5:17 pm on Aug 25, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Yay! Removed the link and meta backslashes and made the html lower case - now it validates.

Cheers for all the tips! :)