1

Hello, I know there are a few different doctypes out there, but which is a good one to use and benefits associated with it?

Thank you, Ronson

flag

2 Answers

1

I guess that depends on what you want to do... currently, I'm using a lot of

xhtml 1.0 strict

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

 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

and

html 4.0 strict

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/html4/strict.dtd">

because they trigger the browser to use standards/almost standards mode.

HTML 5's doctype: <!DOCTYPE html> is being used on some sites already even though it's not officially implemented yet. If you want to be bleeding edge and use html 5, you'll want to read up on the new structural tags, but be prepared that you may have to do extra work to support these tags cross browser.

read more about almost standards mode here:
http://en.wikipedia.org/wiki/Quirks_mode#Almost_standards_mode

read more about html 5 here:
http://www.w3schools.com/tags/html5.asp

Whatever you do, you want to avoid any doctype that will force the browser into quirks mode, which will cause things to behave unpredictably across all browser and that means more hacks.

link|flag
0

I've expanded on doctypes here: http://danvogler.com/articles/doctypes-w3c-validator.html

link|flag

Your Answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.