Forum Moderators: open

Message Too Old, No Replies

Any prob to expect if I put doc type (don't have one now).

please help confirm

         

hulahoop

1:08 pm on Apr 11, 2006 (gmt 0)

10+ Year Member



Hello,

I have never put a doctype for my site and am about to but I am scared... I just want to check up with all you experts if putting a doc tupe may cause my pages to load funny or should I expect anything wrong.

I am still mixing html stuff like <font> and CSS for certain reasons. So I will be using transitional.

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">

Just need someone to re-affirm or comfort me that adding the doc type will not cause any unwanted issues.

encyclo

2:01 pm on Apr 11, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



When you add most doctypes, you will switch most modern browsers into a stricter parsing mode where published standards are more closely followed. See Quirks Mode vs. Standards Mode [webmasterworld.com] for some more information.

I would suggest trying to add the full doctype you mention and see whether page rendering is altered. If the full version breaks your layout, you can use the following doctype without the DTD URL which does not switch the rendering mode:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

This "half" doctype is usually the best choice when, like you, you are dealing with legacy content with tables for layout - it is not really appropriate for new content.

hulahoop

2:33 pm on Apr 11, 2006 (gmt 0)

10+ Year Member



Hi Encyclo,

Thanks for your help. So you mean that I should use without the DTD.

I have several other questions too:
1) Does this mean using doctype without DTD, this will not mess with my pages?
2) Any advise on how to best move to STRICT as I forsee it will take a lot of upgrade? Or is it really necessary?
3) Will it hurt me if I don't use a DOCTYPE?

Thanks again.

encyclo

7:01 pm on Apr 11, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



If it is an existing site that you are converting, yes I would recommend the doctype without the link to the DTD. This will enable you to validate your pages more easily without altering the rendering mode.

Leaving out a doctype won't hurt you, but the presence of HTML errors can be damaging as they may affect spidering by search engines. When you have a doctype, you can use the validator to identify and correct these errors.

Switching to a "strict" doctype is a good idea in the longer term - the strict doctype will switch you to standards-compliance mode in modern browsers, so you will need to adjust your layout. A strict doctype means also that you will need to remove presentational elements from your markup (font tags, etc.) and use CSS for styles.

Moving to a strict doctype is not a required step, but it leads to having much more streamlined markup and smaller page sizes, as well and improvements in accessibility.