Forum Moderators: open

Message Too Old, No Replies

Validation problem

HTML element not allowed here

         

tbear

2:18 pm on Nov 13, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I decided to throw caution to the wind and see if my pages validate.........

:( 7 errors

So, 4 of them were tags used in places they shoudn't be, which was easy to correct and something I will remember (in this case, using <h> tags within a link <a> tag)
:)

However, the other three have me stumped!

They all appear to be related to my having the <html> tag where it is¿¿

The first error says this:
Error Line 4 column 5: document type does not allow element "HTML" here.
<html>

Now this is what I have in the top of my page:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<html>
<head>
<title>
Title here.
</title>
<meta name="description" content="Description here.">
<meta name="keywords" content="Some keywords here.">
<link rel="stylesheet" type="text/css" href="stylesheet2.css">
<script type="text/javascript">
if (parent.frames.length > 0) {
parent.location.href = self.document.location
}
</script>
</head>
<body>

</body>
</html>

I'm beginning to believe that this problem is somehow related to the doctype declaration at the top....

Is there another way/place to put the <html> tag?
Could the problem have been caused by the javascript (I took it out and the error is the same)?
Could someone help me out here, please?

encyclo

2:53 pm on Nov 13, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



It's the charset meta tag which is causing the problem - it needs to be moved within the head section:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
[b]<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">[/b]

:)

tbear

1:03 am on Nov 14, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Ahhhh, Hey, it validates :)

Thanks encyclo, I knew it was something I should know, but I didn't.

Now I need to change the rest of the site and see what other problems I can find.

Oh, the css is good too, I'm so proud :) and I learned somethings....