Alex Alex - 3 years ago 180
HTML Question

Selecting a DOCTYPE for HTML 5 + all browsers

I'm using some HTML5 features on a web page and wondered what the best DOCTYPE is. Currently, this is the DOCTYPE and XMLNS:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
<html xmlns="">

Should I use the new HTML 5 DOCTYPE?

<!DOCTYPE html>

Will older browsers (IE7, FF 2.x) recognize and render the page correctly? What's the best practice in this situation? Thanks.

Answer Source

Yes, older browsers will work fine. The reason "<!DOCTYPE html>" was chosen in HTML 5 is because it is the smallest a doctype can be and yet still trigger standards compliance mode on those browsers you mention.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download