| 3:51 pm on Aug 16, 2005 (gmt 0)|
In most cases, a doctype is not required, but it is highly recommended. If you want your pages to adhere to a particular standard, like XHTML 1.0, then it is required. Adding a doctype is helpful for browsers and robots to know what to expect.
There is a list of valid DocTypes, or DTDs, on the W3's website: [w3.org ] You can also find tools to validate your HTML on their website.
| 3:53 pm on Aug 16, 2005 (gmt 0)|
| 3:54 pm on Aug 16, 2005 (gmt 0)|
it is good practice to have a DOCTYPE and valid code adhering to the choosen doctype.
While most browsers try to render any HTML even without a doctype, the results are, ahem, somewhat unpredictable.
If you are using mainly 'standard' html, you may choose a HTML 4.01 doctype.
You may look into these links for further reading:
Recommended DTDs to use in your Web document
Choosing a DOCTYPE
| 4:14 pm on Aug 16, 2005 (gmt 0)|
thank you both!
| 10:59 am on Aug 18, 2005 (gmt 0)|
ok this might seem like a silly question but I put in the doctype above the <html> tag and it totally messed up my formatting - I tried putting both 4.01 strict and transitional.
Though to be honest Im not sure what form of HTML im using. Im using stlye sheets and have closed all tags.
| 11:15 am on Aug 18, 2005 (gmt 0)|
Sounds like a Quirks Mode vs. Standards Mode [webmasterworld.com] problem - pages with a full doctype switch the browser into what is called "standards-compliant mode" which alters the way pages are handled.
Whilst you get your basic validation sorted out, try using this "half" doctype:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
Once you're validated, then you can switch to a "full" doctype and sort out the display problems.
| 11:57 am on Aug 18, 2005 (gmt 0)|
thanks! Should this go on all pages or only the index page?
| 12:06 pm on Aug 18, 2005 (gmt 0)|
You should put the doctype on every page. :)