Jump to content

!Doctype


careyd

Recommended Posts

I have built a site with Expression Web4 and it generates DOCTYPE code.

 

I am starting to adopt HTML5/CSS3 and would like to deeply understand all that there is to know about "DOCTYPE"

 

I am concerned that the generated code (now very dated) will interfere with my site.

 

Yes, I am new to these topics.

 

 

 

Link to comment
Share on other sites

The original purpose of the document type declaration was to tell the browser the rules that the document follows. In HTML, it doesn't serve that purpose anymore. The browser uses the doctype to determine which version of HTML is being used and how to render it.

 

An invalid doctype, an old doctype or no doctype at all will cause the page to render in quirks mode, which is the way browsers used to render pages over 10 years ago. This was for backwards compatibility on pages built with HTML 3.2 and older. Specifying a valid HTML 4.01, XHTML or HTML 5 doctype will make the browser render in standards compliant mode, in which browsers all render things the same way, theoretically.

 

It's important to build your pages in standards compliant mode. The page davej linked you to has a list of all valid doctype declarations. I would not recommend using HTML 4.01 or XHTML anymore, they're already getting old. Use HTML 5.

Link to comment
Share on other sites

Going to HTML5 will still give backward compatibility for the most part, but when you validate, you will get errors and/orwarnings about depeciated, obsolete, or modified tags/attributes. Those can be corrected over time and converting the local obsolete attributes to CSS replacements will generally be transparent. You should get rid of the obsolete/depreciated attributes not just to make maintenance easier, but also for efficiancy. When a modrtn browser encounters an obsolete attribute, it has to execute extra code to convert it to CSS, as the older attributes are no longer understood by the rendering engines or the renderObjects that need to fire for paint operations.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...