1

Currently we have the following DOC type:

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

There are some initiatives to change to the following DOC type:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 TRANSITIONAL//EN"  >

The argument is for the enforcement of strict W3C standards for cross browser compatibility, my question is, if we adopt the new DOC type,

  1. without changing parts of the codes that are still in the 4.0.1 HTML definition to XHTML 1.0 definition, will it be of any use?

  2. will changing to the new DOC type definition cause my existing JSP / HTML to break (suppose those that conform to 4.0.1 perfectly but not tested against 1.0 XHTML)?

Oh Chin Boon
  • 23,028
  • 51
  • 143
  • 215
  • 1
    Just wondering, why XHTML 1.0? Why not HTML5? Anyway... http://hsivonen.iki.fi/doctype/ There's a very nice table at the bottom. Look what your current doctype says and if your new one is valid... – BalusC Aug 12 '11 at 02:02
  • Hi BalusC, i would like to answer that, however, i am not aware why not either. The argument provided for not doing HTML 5 is it is a future thing. I'm reading your link, thanks! – Oh Chin Boon Aug 12 '11 at 02:04
  • The HTML5 spec is by itself indeed not finished. But the browser compatibiliy for HTML4 documents with HTML5 doctype is already known for long. – BalusC Aug 12 '11 at 02:13

1 Answers1

1

I'll assume that you actually mean the following as the new doctype:

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

Functionally, your JSP/HTML will not break. The modern webbrowser is forgiving enough and it'll close open tags where needed and it'll accept unspecified attributes. In the meanwhile you should however really consider to fix them anyway so that it w3-validates against the new doctype as much as possible.

However, major problems may arise in look'n'feel as specified by CSS. Your old doctype pushes the the browser in quirksmode which reveals among others the pretty serious box model bug in MSIE. With this bug, MSIE accounts the element's padding and border into element's width. So if you change this doctype, you'll only see changes in MSIE.

If your website was designed on normal webbrowsers according the web standards (i.e., it's been designed for Firefox, Chrome, Safari, etc), then you don't need to worry. It'll only going to look like in MSIE as intented, which is just an advantage.

But if your website was designed for MSIE and hereby thus ignoring the webstandards, then you'll have to make a lot of changes in CSS (mainly width/padding/border/margin) so that it look the same in MSIE as intented. You'll also gain the additional advantage that it will now look properly on normal browsers.

As to the doctype choice, well this is going to be subjective, but if you need my opinion, then read the following answers:

Community
  • 1
  • 1
BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
  • Hi BalusC, thanks, i am going through your references, i would like to mention that we need to maintain browser compatibility with IE 6, in such scenario, will your first paragraph still hold? – Oh Chin Boon Aug 12 '11 at 02:38