wampthing Posted November 13, 2006 Share Posted November 13, 2006 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? Quote Link to comment Share on other sites More sharing options...
TCH-Andy Posted November 13, 2006 Share Posted November 13, 2006 It depends what the rest of the code is really in Personally, I tend to now code in XHTML - but I always used to use HTML 4.01. I prefer the rigour of XHTML, I think I can get a more consistent coding standard from it. Quote Link to comment Share on other sites More sharing options...
wampthing Posted November 13, 2006 Author Share Posted November 13, 2006 So if I use a standard that is more rigorous, I have a higher chance of having it act the same in most browsers. I assume the downside is that I have to be more strict in the code that I use? Quote Link to comment Share on other sites More sharing options...
TCH-Bruce Posted November 13, 2006 Share Posted November 13, 2006 That would be correct Dave. Most CMS packages produce XHTML documents. I prefer it myself. Quote Link to comment Share on other sites More sharing options...
wampthing Posted November 13, 2006 Author Share Posted November 13, 2006 Cool beans Thanks for your help Quote Link to comment Share on other sites More sharing options...
Deverill Posted November 13, 2006 Share Posted November 13, 2006 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. Quote Link to comment Share on other sites More sharing options...
cak Posted November 15, 2006 Share Posted November 15, 2006 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: *ttp://www.sitepoint.com/forums/showthread.php?t=393445 *ttp://lachy.id.au/log/2005/12/xhtml-beginners Using a strict DOCTYPE instead of a transitional DOCTYPE will yield tangible benefits, though. HTH, Carol Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.