HTML页面meta标签内容详解

所有浏览器都支持meta标签,用于提供页面相关信息,以名/值对形式呈现。属性content定义http-equiv和name相关信息,http-equiv指定服务器返回给浏览器的有用信息,name将content内容关联到名称上,html和xhtml无固定name值。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

所有的浏览器都支持meta标签,用于提供页面相关信息,信息都是以名(http-equiv和name标示)/值(content标示)对的形式现实。

属性content,用于定义http-equiv(定义http头部信息,服务器向浏览器提供的信息)和name(指定网页信息的相关的名称)相关的信息;

http-equiv就是在HTTP头部指定了一些服务器返回给浏览器的有用信息

<meta http-equiv=“参数” content="参数变量值">

ds作用
http-equivcontent-type设置页面的字符集 <meta http-equiv=“content-Type” content="text/html; charset=utf-8"> html5页面的做法是直接使用
expires设置页面的过期时间<meta http-equiv=“expires” content="Wed, 20 Jun 2007 22:33:00 GMT">
refresh 自动刷新到新页面<meta http-equiv=“Refresh” content="2;URL=http://www.net.cn/"> //2代表页面停留多长时间后跳转都后面的网址上
set-cookie如果cookie过期,则自动删除本地cookie <meta http-equiv=“Set-Cookie” content="cookievalue=xxx;expires=Wednesday, 20-Jun-2007 22:33:00 GMT; path=/">
pragma禁止浏览器从本地调用缓存 <meta http-equiv=“Pragma” content="no-cache">
window-target强制页面在浏览器窗口独立显示 <meta http-equiv=“Window-target” content="_top">
page_enter, page_exit设定进入页面和退出页面的效果 < meta http-equiv=“Page-Exit” content=“revealTrans(duration=1.0,transtion= 12)”>
cache-control清除缓存 < meta http-equiv=“cache-control” content=“no-cache”>

name把content的内容关联到一个名称上,html和xhtml都没有执行固定的name值,可以自由使用对自己和源文档的读者来说富有意义的名称

nameauthor 指定页面的所有者< meta name=“author” content=“James Bond”/>
description页面描述,用于搜索引擎收录< meta name=“description” content=“中国设计网是中国起步最早的设计门户网站,设计师的网上家园”/>
keywords页面关键词,用于被搜索引擎收录< meta name=“keywords” content=“设计, 师妹”/>
generator用于说明网站制作生成工具< meta name=“generator” content=“Microsoft”/>
revised网页文档的修改时间< meta name=“revised” content=“设计网, 6/24/2015”/>
viewport用于控制页面缩放<meta name=”viewport” content=”width=240, height=320, user-scalable=yes, initial-scale=2.5, maximum-scale=5.0, minimun-scale=1.0”> //width指定页面的可视宽度, 像素值或device-width, initial-scale设置页面初始化时的缩放比例,user-scalable指定是否可以缩放可视区域, maximum-scale, minimun-scale页面最大最小缩放比例。 如果想要页面在不同的设备都按照页面的设计尺寸缩放(那些宽度固定的网站)就不要使用viewport属性
copyright网页版权信息< meta name=“copyright” name=“Copyright 2015 Ironside”/>
renderer使用哪种模式显示网页<meta name=“renderer” content="webkit

内容转自 https://www.cnblogs.com/zhang-jian/p/4936479.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值