头部使用规范
起始标签使用
html标签必须加上mip标记,即:
必须包含
和 标签必须在head标签中包含字符集声明: ,字符集统一为utf-8
必须在head标签中包含viewport设置标签: css" href="https://mipcache.bdstatic.com/static/v1/mip.css" >
必须在body标签中包含
必须在head标签中包含
页面元素使用规范
MIP HTML 禁止使用对页面性能以及安全有较大影响的标签,请将其替换为MIP的特有标签(例如:将img标签替换为mip-img):
标签 | 使用范围 | 备注 |
img | 替换为mip-img | |
video | 替换为mip-video | |
audio | 替换为mip-audio | |
iframe | 替换为mip-iframe | |
style | 替换为 | 只能在head标签中使用一次 |
script | 禁止使用 | 禁止使用script标签, 以下两种情况除外:1)外链mip组件所需js,2)type为 "application/ld+json" 或 "application/json" |
svg | 允许使用 | |
button | 允许使用 | |
link | 允许使用 | |
a | 允许使用,建议使用mip-link组件代替 | 不可以href="javascript:",target必须设置为_blank |
frame | 禁止使用 | |
frameset | 禁止使用 | |
object | 禁止使用 | |
param | 禁止使用 | |
applet | 禁止使用 | |
embed | 禁止使用 | |
form | 替换为mip-form | 内部允许使用input、textarea标签 |
input elements | 禁止使用 | 包括: select, option |
HTML 属性
自定义样式使用规范
出于性能考虑,html 中不允许使用内联style,所有样式只能放到head 的 style 标签里。
正确:
p{color:#00f;}
Hello World!
错误:
验证规范
MIP校验工具地址: