user744587
user744587

Reputation:

Cross Browser Compatibility and docType declaration

I designed a webpage and tested it on firefox, chrome & IE-8. The webpage is displayed fine on firefox & chrome but not on IE. In the process of making it compatible, I changed the DocType declaration from HTML 4.01 Transitional to XHTML 1.1 to HTML 4.01 Strict. This failed to fix the cross compatability. Also, I found that the webpage design is messed up on firefox & chrome when I change the DocType from HTML 4.01 Transitional to XHTML 1.1.

Now my question is, if DocType does matter in designing webpages, which one should I use for cross compatibilty? Is there another solution that does not involve DocType?

Upvotes: 0

Views: 6482

Answers (1)

eric
eric

Reputation: 391

It sounds like you're only changing the DOCTYPE, but not changing any HTML or CSS. This is something you'll need to do since each DOCTYPE will be rendered differently.

I recommend one of the STRICT ones - HTML4.01 STRICT, XHTML1.0 STRICT, or XHTML1.1, depending on your needs. Or HTML5 (although I haven't used it yet myself). Also, make sure you've got the doctype declaration correct and have included the xmlns in the html tag if you're using XHTML.

For reference:

  • QuirksMode has a lot a great information, including browser compatibility info.
  • A List Apart also has really helpful articles.
  • I refer to the HTML and CSS2 Specifications often.

And to check your doctypes:

HTML 4.01 Strict, Transitional, Frameset

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">

XHTML 1.0 Strict, Transitional, Frameset

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

XHTML 1.1

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

HTML5

<!DOCTYPE html>

Upvotes: 4

Related Questions