语义化
- 使用正确标签来表示正确的内容结构,比如要表示导航内容就是用nav标签
- 可以使页面结构化,结构更加的清晰,便于浏览器和搜索引擎解析
- 搜索引擎的爬虫也是要依赖于Html的标记来确定上下文关键字的权重,利于SEO优化
- 提高页面的可读性,很容易将页面区分各个块,便于阅读和理解
meta属性
- 声明文档使用的字符编码
<meta charset="utf-8">
- 声明文档兼容性
<meta httpp-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
- SEO优化
<meta name="description" content="不超过150个字符" /> // 页面描述
<meta name="keywords" content="关键字"/> // 页面关键词
<meta name="author" content="xxx" />定义网页作者
<meta name="robots" content="" />定义网页搜索引擎索引方式,robotterms是一组使用英文逗号「,」分割的值,通常有如下几种取值:none,noindex,nofollow,all,index和follow。
- 移动设备设置viewport
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no, minimal-ui">
- 其他设置
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="HandheldFriendly" content="true">
<meta name="MobileOptimized" content="320">
<meta name="screen-orientation" content="portrait">
<meta name="x5-orientation" content="portrait">
<meta name="full-screen" content="yes">
<meta name="x5-fullscreen" content="true">
<meta name="browsermode" content="application">
<meta name="x5-page-mode" content="app">
<meta name="msapplication-tap-highlight" content="no">