Jump to content

What is the best DocType to use?


wasson23
 Share

Recommended Posts

I use the Adobe CS5 Suite, created the layout images, and using Dreamweaver I created the HTML / CSS and templates. It's looking good, but when I run it through the W3C validator I get 28 errors and 12 warnings! I believe this is mostly due to script.Thank you for your help!

Edited by Wasson23
Link to comment
Share on other sites

I don't have an explanaion for this but I use <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">You can read on w3 page I guess, also somewhere here must be topic for it. But while reading about the best of it, for some reason I found this the best :)I even don't understand for what is good :)

Link to comment
Share on other sites

What is best is to use a strict HTML (not XHTML) doctype. I say that partly because most of your code actually is HTML, not XHTML, partly because XHTML is going to be history soon. But your document is not quite ready for a strict DTD, so I'd start by using a transitional doctype, specifically:<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">Put it at the very top of the document. Remove the <?xml> tag and the second <HTML> tag. Validate it again and fix all the errors. Especially get the style information OUT of your tags and use a CSS style sheet instead. Somehow you have mixed old-fashioned style attributes with CSS in your tags, so you'll want to review CSS. Dreamweaver by itself could not have done all that damage.

Link to comment
Share on other sites

What is best is to use a strict HTML (not XHTML) doctype. I say that partly because most of your code actually is HTML, not XHTML, partly because XHTML is going to be history soon. But your document is not quite ready for a strict DTD, so I'd start by using a transitional doctype, specifically:<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">Put it at the very top of the document. Remove the <?xml> tag and the second <HTML> tag. Validate it again and fix all the errors. Especially get the style information OUT of your tags and use a CSS style sheet instead. Somehow you have mixed old-fashioned style attributes with CSS in your tags, so you'll want to review CSS. Dreamweaver by itself could not have done all that damage.
I am not assuming Dreamweaver has done "all of that damage", I am self admittedly new to validation so I'm trying my best here.I created my template and then created all pages From the template (New Page From..) so I didn't add in the style attributes myself to each page, they are coming from the created template. With that being said, I see what you are saying and will remove the style info from the pages, requiring them to pull from the CSS instead. I wans't clear myself on why those are showing on every page's code. I must have done something unusual with the template, such as left the style attributes of the page editable? I'm not sure, but your info will give me a good starting point for clean up and revalidation.I appreciate your feedback,
Link to comment
Share on other sites

Holy cow - I got it to pass finally. Something I noted during validation;I continued to get the following error on various lines of my code: NET-enabling start-tag requires SHORTTAG YESCryptic to me! But I removed the "/" before the end of the bracket which alleviated the errors.Now I did not code this by hand, I did a majority of it in WYSIWIG in Dreamweaver CS5.If I should be coding without the "/" within the same bracket, why would DW do this to me? Is there something I should define at the beginning of a webpage or within properties to ensure that it will handle this properly?Thanks for your ideas :)

Link to comment
Share on other sites

I continued to get the following error on various lines of my code: NET-enabling start-tag requires SHORTTAG YESCryptic to me! But I removed the "/" before the end of the bracket which alleviated the errors.
The "/" is used to close 'empty' tags in XHTML where all tags must be closed. In HTML it is not required (and in fact, invalid as you found out)Empty tags are those that only have one tag and no 'content' like the <img /> and <br /> tags. Tags like <div>...</div> and <span>...</span> have a start tag and an end tag and 'content' between the two.
Now I did not code this by hand, I did a majority of it in WYSIWIG in Dreamweaver CS5.If I should be coding without the "/" within the same bracket, why would DW do this to me?
The WYSIWIG part of DW (actually any WYSIWIG) will add a lot of things it shouldn't. That's why most of us here recommend not using the WYSIWIG part of any editor and stick to using the text editor and testing in a real browser.
Is there something I should define at the beginning of a webpage or within properties to ensure that it will handle this properly?
Yeah. A DTD. :) Preferably a Strict one.
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...