On Sat, Nov 20, 2010 at 9:13 AM, Keith Purtell <keithpurt...@keithpurtell.com> wrote:
> I have a newbie question. I'm aware from discussion here that IE may run > in "quirks mode" depending on how the html document is set up. But, it > wasn't until viewing a css tutorial on lynda.com that I saw a specific > way to prevent (most) IE quirks. Author Bill Weinman suggests the > following code at the top of each html document. I've made the change > throughout my site, but I want a second opinion about whether this is > best practice. Thank you. > > (I noticed that after I made this change and opened ea page, Dreamweaver > showed an alert that it had added a closing space and forward slash to > many of my tags. Mostly in the head, but also with images and some code > that embeds a Flash object for playing mp3 files. I'm curious as to why > it did that.) > > <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" > "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> > <?xml version="1.0" encoding="utf-8"?> > <html xmlns="http://www.w3.org/1999/xhtml"> > I'm assuming from your post that you had no doctype declaration on your pages until you saw the css tutorial. Putting anything before the doctype declaration (!DOCTYPE ...) throws a web page into quirks mode. If you don't declare a doctype, your entire page comes before the doctype declaration, so you're likely to be serving HTML -- and your page is in quirks mode. HTML doesn't require that all tags be closed (e.g. <p>stuff here</p>) or self-closing (e.g. <img src="stuff here " />), but XHTML does require it. So when you "changed" your doctype to XHTML by adding that specific doctype, DW fixed your page so that all opened tags are closed. There's more to know about IE8-and-below not supporting XHTML, but I haven't wrapped my head around that yet. Regards, Beth Lee www.bethleedesign.com ______________________________________________________________________ css-discuss [cs...@lists.css-discuss.org] http://www.css-discuss.org/mailman/listinfo/css-d List wiki/FAQ -- http://css-discuss.incutio.com/ List policies -- http://css-discuss.org/policies.html Supported by evolt.org -- http://www.evolt.org/help_support_evolt/