标签有哪些属性,有什么作用?
标签属性
- charset:编码
- name:content关联到某一属性
- http-equiv:content关联头部
- content:元信息
name 作用
SEO - 优化
<!-- 页面标题<title>标签(head 头部必须) --><title>your title</title><!-- 页面关键词 keywords --><meta name="keywords" content="your keywords"><!-- 页面描述内容 description --><meta name="description" content="your description"><!-- 定义网页作者 author --><meta name="author" content="author,email address"><!-- 定义网页搜索引擎索引方式,robotterms 是一组使用英文逗号「,」分割的值,通常有如下几种取值:none,noindex,nofollow,all,index和follow。 --><meta name="robots" content="index,follow">
viewport - 移动端视口
<meta name="viewport" content="width=device-width,initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
http-equiv 作用
X-UA-Compatible(浏览器采取何种版本渲染当前页面)
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/> //指定IE和Chrome使用最新版本渲染当前页面
cache-control(指定请求和响应遵循的缓存机制)
<meta http-equiv="cache-control" content="no-cache">
refresh(自动刷新并指向某页面)
<meta http-equiv="refresh" content="2;URL=https://www.baidu.com/"> // 意思是2秒后跳转百度