头部使用规范
起始标签使用 <!doctype html>
html标签必须加上mip标记,即: <html mip>
必须包含 <head>和 <body>标签
必须在head标签中包含字符集声明: <meta charset="utf-8">,字符集统一为
utf-8必须在head标签中包含viewport设置标签: <meta name="viewport" content="width=device-width,initial-scale=1">,推荐包含
minimum-scale=1必须在head标签中包含 < link rel="stylesheet" type="text/css" href="
https://mipcache.bdstatic.com/static/v1/mip.css " >必须在body标签中包含 <script src="
https://mipcache.bdstatic.com/static/v1/mip.js " ></script >必须在head标签中包含 <link rel="canonical" href="http(s)://xxx" >
页面元素使用规范
MIP HTML 禁止使用对页面性能以及安全有较大影响的标签,请将其替换为MIP的特有标签(例如:将img标签替换为mip-img):

HTML 属性
MIP HTML 中所有
on开头的属性都不允许使用,如:onclick,onmouseover。MIP HTML 中允许使用
on属性。- MIP HTML 中不允许使用
style属性。
自定义样式使用规范
出于性能考虑,html 中不允许使用内联style,所有样式只能放到head 的 style 标签里。
- 正确:
<head>
<style mip-custom>
p { color: #00f;}
</style>
</head>
<body>
<p>Hello World!</p>
</body>- 错误:
<p style="color:#00f;">Hello World!</p>
验证规范
MIP校验工具地址:
- 文章导航