Whenever I seem to add a doctype, it messes up my site layout. How can I add the doctype properly without problems?
You will have to make sure you remove any special characters that are not needed. Extra spaces, line breaks etc... Let us know what you come up with. Good luck...
You can not write just any code and just insert your doc type declarations. For instance XHTML, requires you properly nest your tags. Write your code according to what doc type fits in. Let me know if you need any help.
you may want to try this, as it will let you get away with a few issues in the code: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> Code (markup): You may then check you code here: http://validator.w3.org/
The browser uses the DTD to decide whether to render the html as standard or in a backward compatible (quirks) mode. IE and Opera are the main browsers greatly affected by the DTD switch. IE, because IE<6 is really crappy about standards, and Opera because it is an IE wannabe in quirks mode. Firefox and Safari will show fewer differences because they've always tried to be standards compliant. The browser does not use the DTD, otherwise. The validator, otoh, has to have a DTD in order to know which ruleset to validate against. A loose or transitional DTD says to the validator, "any html element or attribute that has ever been valid is ok". A strict DTD says, "go by the book". A loose DTD is handy if you must work with legacy docs that contain deprecated or obsolete markup, and the budget won't allow for a complete clean-up. There is no sane reason to use deprecated or obsolete markup on new documents, so they should always have a strict DTD. cheers, gary