Mortgage Insurance - Loans - Fast Loans - Libros de historia - Wisconsin Flags

PDA

View Full Version : Anyway of adding doctypes without messing up the layout?


emkay
Jun 28th 2006, 9:23 am
Whenever I seem to add a doctype, it messes up my site layout. How can I add the doctype properly without problems?

ServerUnion
Jun 28th 2006, 9:26 am
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...

emkay
Jun 28th 2006, 9:26 am
Oh I'll try that, thanks.

dilipsam
Jun 28th 2006, 10:48 am
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.

emkay
Jun 29th 2006, 5:03 am
so the code has to be valid for the doctype to work?

ServerUnion
Jun 29th 2006, 5:54 am
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">


You may then check you code here: http://validator.w3.org/

emkay
Jun 29th 2006, 8:39 am
Ok thanks for the help, I'll try it out

FeelLikeANut
Jun 29th 2006, 9:39 am
so the code has to be valid for the doctype to work?More or less, yes.

kk5st
Jun 29th 2006, 10:22 pm
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