HTML <meta> http-equiv 属性
标签" href="tag-main.html"><main>
<map>
<mark>
<menu>
<meta>
<meter>
<nav>
<noframes>
<noscript>
<object>
<ol>
<optgroup>
<option>
<output>
<p>
<param>
<pre>
<html>
<picture>
<progress>
<q>
<rp>
<rt>
<ruby>
<s>
<samp>
<script>
<section>
<select>
<small>
<source>
<span>
<strike>
<strong>
<style>
<sub>
<summary>
<sup>
<table>
<tbody>
<td>
<textarea>
< template>
<tfoot>
<th>
<thead>
<time>
<title>
<tr>
<track>
<tt>
<u>
<ul>
<var>
<video>
<wbr>
HTML <meta> http-equiv 属性
实例
每隔 30 秒刷新一次文档:
<head>
<meta http-equiv="refresh" content="30">
</head>
<meta http-equiv="refresh" content="30">
</head>
浏览器支持
所有主流浏览器都支持 http-equiv 属性。
定义和用法
http-equiv 属性提供了 content 属性的信息/值的 HTTP 头。
http-equiv 属性可用于模拟一个 HTTP 响应头。
HTML 4.01 与 HTML5之间的差异
使用 http-equiv 已经不是规定 HTML 文档的字符集的唯一方式:
- HTML 4.01: <meta http-equiv="content-type" content="text/html; charset=UTF-8">
- HTML5: <meta charset="UTF-8">
语法
<meta http-equiv="content-type|default-style|refresh">
属性值
| 值 | 描述 |
|---|---|
| content-type | 规定文档的字符编码。 实例: <meta http-equiv="content-type" content="text/html; charset=UTF-8"> |
| default-style | 规定要使用的预定义的样式表。 实例: <meta http-equiv="default-style" content="the document's preferred stylesheet"> 注释:上面 content 属性的值必须匹配同一文档中的一个 link 元素上的 title 属性的值,或者必须匹配同一文档中的一个 style 元素上的 title 属性的值。 |
| refresh | 定义文档自动刷新的时间间隔。
实例: <meta http-equiv="refresh" content="300"> 注释:值 "refresh" 应该慎重使用,因为它会使得页面不受用户控制。在 W3C's Web 内容可访问性指南 中使用 "refresh" 会到导致失败。 |
HTML <meta> 标签