一般用JS支持H5的写法
(function() { // 页面头部 var a = ['section', 'article', 'nav', 'header', 'footer' /* 其他HTML5元素 */]; for (var i = 0, j = a.length; i < j; i++) { document.createElement(a[i]); } })();
不用JS的写法,用HTML命名空间
<!doctype html>
<html <html xmlns="http://www.w3.org/1999/xhtml" xmlns:html5="http://www.w3.org/1999/xhtml"><head>
<meta charset="utf-8">
<title>赤壁之战</title>
<meta http-equiv="X-UA-Compatible" content="edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="Keywords" content="赤壁之战">
<meta name="description" content="赤壁之战">
<link href="css/style.css" rel="stylesheet">
<style>
html{background: #ccc;}
.section, section, html5\:section {display: block;padding: .5em;border-left: 3px solid #ddd;color: #999;}
</style>
</head>
<body>
<html5:section>...</html5:section>
</body>
</html>