Been writing web apps for years and this line:
<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
Has always confused me. What is it for exactly? What are the implications if I remove it?
I understand the w3c conventions about nested elements etc but what actually happens why is the declaration there do browsers fail or something if I take it out?
Cheers,
Pete
It kicks the browser into standards mode, which makes the browser properly render elements. Not every doctype kicks the browser into standards mode, see this chart. If a valid doctype is not used to kick the browser into standards mode, the browser will basically try to render your page according to “standards” ( or lack thereof ) in 2002-2003 when everyone used crappy table layouts. You do not want quirks mode.
Conclusion: always use a doctype.