Jump to content



Recommended Posts

I was following a tutorial about css positioning. I wanted to center the main div and it suggested using margin: auto.


After doing that, it did center in firefox, but not in explorer. The code they wrote however DID center in explorer. After a long while of trouble shooting, I see that the difference in code is simply the doctype.

I am currently coding in PSPad. their default html document uses

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

It looks like my dreamweaver uses the same.


The site that I was copying from used:

><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

What is the best to use?

In doing some online research I came across this site: http://alistapart.com/stories/doctype/.


anyone have a strong opinion?

Link to comment
Share on other sites

So if I use a standard that is more rigorous, I have a higher chance of having it act the same in most browsers.
This is true, but only to the extent that the browser implements that standard faithfully. If a browser doesn't implement the full standard you'll be right back to the situation pretty recently when you could count on IE not doing CSS properly because their CSS rule implementation was... uhm, flawed.
Link to comment
Share on other sites

Markup experts will tell you that Internet Explorer has no support whatsoever for XHTML, so there are no "real" benefits (and more than a few drawbacks) to using it on most public sites. Here are a couple of good articles on the subject:





Using a strict DOCTYPE instead of a transitional DOCTYPE will yield tangible benefits, though.




Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...