Forum Moderators: open
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.
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.
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.
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.