Forum Moderators: open
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN"
"http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd">
Here's the meta tag if that helps.
<META http-equiv=Content-Type content="text/html; charset=windows-1252">
The validator didn't like my closing head tag and opening body tag. I took them out and the page validated.
Any ideas why it didn't like my </head> and <body> tags?
Is it a good idea to leave them out?
First off, you're using a dodgy doctype. The two main HTML4.01 doctypes are:
Strict:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
Transitional:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
Added: see FAQ: Choosing a Doctype [webmasterworld.com] for more info.
Fix this first. Then post the relevant bit of your code, from opening <html> to opening <body> (just the brief code, not all your site specific stuff). It's generally not a good idea to leave out header and body tags; you've got a syntax error somewhere.
The doctype and opening style tag were the problems
I changed the doctype and put quotes around the items in the opening style tag, repositioned a few <br> tags, then put the </head> and <body> tags back in and it worked.
I used the strict doctype and at first the style tag looked like this
<style rel=stylesheet type=text/css href=pageTwo.htm>
And I corrected it to read
<style rel="stylesheet" type="text/css" href="pageTwo.htm">
And the new doctype worked better than the one I was using.
Thank you for your help, you're fabulous.
That is, in an HTML document, the first "/" seen after <head> is assumed to be the "/" of the closing </head> tag, even if it isn't.
Don't use other XHTML tags, like <hr /> or <br />, in an HTML document either. Stick to plain <hr> type tags.