Forum Moderators: open
I am getting some validation errors from W3C's Markup Validation Service. It goes like so:
[pre]1. Line 11, column 6: end tag for element "HEAD" which is not open
2. Line 14, column 31: document type does not allow element "BODY" here[/pre] In my ASP-generated HTML page one can find:
[pre]<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<!-- Begin <html> -->
<html>
<!-- Begin <head> -->
<head>
<title>Vertigo home page</title>
<meta http-Equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="src/css/layout.css" />
</head>
<!-- End <head> -->
<!-- Begin <body> -->
<body onLoad="preloadImages();">[/pre] My question is: should I get rid of the remarks before the BODY tag or is there a different issue causing this?
Thank you very much.
Dave
Comments are usually included to explain to subsequent developers what each part of the code does. It's unusual to explain just before the opening <body> tag that this is where the body of the document begins.
I would guess it's the use of unescaped angle brackets within the comments that is tripping up the validator. There don't seem any other obvious errors.
One other thing though... you're using a 4.01 doctype, so you don't need a trailing slash in the link tag - that's an xhtml convention.
I've taken all pre-body comments out of the pages and fixed the link tag. It now looks like this:
[pre]<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Vertigo home page</title>
<meta http-Equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="src/css/layout.css">
</head>
<body onLoad="preloadImages();">[/pre] However I still get the exact same errors:
[pre]1. Line 11, column 6: end tag for element "HEAD" which is not open
2. Line 14, column 31: document type does not allow element "BODY" here[/pre]{to just name a few} Why is this happening?
[edited by: dnimrodx at 5:06 pm (utc) on Feb. 27, 2005]
<link rel="stylesheet" type="text/css" href="src/css/layout.css"[b] /[/b]> You are using an XHMTL closing tag on your link rel. Try removing that and see what happens...
<link rel="stylesheet" type="text/css" href="src/css/layout.css"> Hmmm, your first example has a closing XHTML tag for the link rel. Your second example does not.
Ooops, didn't read ronin's last comment...
One other thing though... you're using a 4.01 doctype, so you don't need a trailing slash in the link tag - that's an xhtml convention.
[edited by: pageoneresults at 5:09 pm (utc) on Feb. 27, 2005]
Thanks a lot!
[EDIT:]
Hmmm, your first example has a closing XHTML tag for the link rel. Your second example does not.