开发者

Selecting a DOCTYPE for HTML 5 + all browsers

开发者 https://www.devze.com 2022-12-31 16:53 出处:网络
I\'m using some HTML5 features on a web page and wondered what the best DOCTYPE is. Currently, this is the DOCTYPE and XMLNS:

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" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

Should I use the new HTML 5 DOCTYPE?

<!DOCTYPE html>

Will older browsers (IE7, FF 2.x) recognize and render the page correctly? W开发者_如何学JAVAhat's the best practice in this situation? Thanks.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消