html中header结构详解

html中header结构详解


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
HTML header结构
                    
  < html >
      < head >
           <!--
              base标签为页面上的所有链接规定默认地址或默认目标。
              通常情况下,浏览器会从当前文档的 URL 中提取相应的元素来构造新的相对 URL 。
              使用 <base> 标签可以改变这一点。浏览器随后将不再使用当前文档的 URL,而使用<base>指定的基本 URL
              来作为相对 URL。这其中包括 <a>、<img>、<link>、<form> 标签中的 URL。
                                 
              在 HTML 中,<base> 标签没有结束标签;在 XHTML 中,<base> 标签必须被正确地关闭。
              <base> 标签必须位于 head 元素内部。
                                 
              target可选的属性
              _blank
              _parent
              _self
              _top
              framename
              例如将target设置为_blank将使得页面中所有的连接将在新窗口中打开。
           -->
          < base  href = "http://www.w3school.com.cn/i/"  />
          < base  target = "_blank"  />
                      
          <!--
            meta标签的属性定义了与文档相关联的名称/值对。
            当属性为http-equiv时,值可以为content-type,expires,refresh,set-cookie等,content 属性关联到 HTTP 头部。
            当属性为name时,值可以为author,description,keywords,generator,revised,others等,content 属性关联到一个名称。
          -->
          < meta  http-equiv = "Content-Type"  content = "text/html; charset=gb2312" >
          <!--
            charset设置网页的文件编码,不一定是utf-8,也可能是gb2312,gbk等,根据实际情况修改。
            content-type,可以为mime/subtype,常见为text/html,image/jpg等。
          -->      
          < meta  http-equiv = "expires"  content = "2005/05/05 18:00:00" >
          <!--脱机浏览的过期时间-->
          < meta  http-equiv = "pragma"  content = "no-cache" >
          <!--禁止网页从缓存中读取-->
          < meta  http-equiv = "Refresh"  content = "5;http://users7.nofeehost.com/luan123/" >
          <!--网页重新定向-->
          < meta  http-equiv = "set-cookie"  content = "2005/05/05 18:00:00" >
          <!--设置网页的cookie过期时间-->
          < meta  http-equiv = "Window-target"  content = "_top" >
          <!--设置网页中链接的目标窗口-->
          < meta  http-equiv = "Page-Enter"  content = "revealTrans(duration=1000000,transition=50000000)" >
          <!--设置网页的打开效果-->
          < meta  http-equiv = "Page-Exit"  content = "revealTrans(duration=1000000,transition=50000000)" >
          <!--设置网页的关闭效果-->
                            
          < meta  name = "keywords"  content = "overmind,zerg,protoss" >
          <!--设置网页的关键字,搜索的时候优先!!!重要!!! 该数据被搜索引擎编入索引-->
          < meta  name = "description"  content = "哈哈哈哈哈" >
          <!--插入描述 搜索时被搜索引擎编入索引-->
                            
          < title >无标题文档</ title >
          <!-- <title> 标签是 <head> 标签中唯一要求包含的东西。 -->
                            
          < link  rel = "stylesheet"  type = "text/css"  href = "/html/csstest1.css"  >
          <!--
              在 HTML 中,<link> 标签没有结束标签。
              在 XHTML 中,<link> 标签必须被正确地关闭。
              <link> 标签定义文档与外部资源的关系。
              <link> 标签最常见的用途是链接样式表
              link 元素是空元素,它仅包含属性。
              此元素只能存在于 head 部分,不过它可出现任何次数。
              标准属性
              id, class, title, style, dir, lang, xml:lang
           -->
          < style  type = "text/css" >
              h1 {color:red}
              p {color:blue}
          </ style >
          <!--
              <style> 标签用于为 HTML 文档定义样式信息。
              在 style 中,您可以规定在浏览器中如何呈现 HTML 文档。
              type 属性是必需的,定义 style 元素的内容。唯一可能的值是 "text/css"。
              style 元素位于 head 部分中。
                                 
              所有主流浏览器都支持 <style> 标签。
           -->
                              
           < script  type = "text/javascript"  src = "myscripts.js" ></ script >
           < script  type = "text/javascript" >
              document.write("Hello World!")
           </ script >
           <!--
               <script> 标签用于定义客户端脚本,比如 JavaScript。
               script 元素既可以包含脚本语句,也可以通过 src 属性指向外部脚本文件。
               必需的 type 属性规定脚本的 MIME 类型。
               JavaScript 的常见应用时图像操作、表单验证以及动态内容更新。
                                  
               假如此元素内部的代码没有位于某个函数中,那么这些代码会在页面被加载时被立即执行。<frameset> 标签之后的脚本会被忽略。
               请参阅 noscript 元素;对于那些在浏览器中禁用脚本或者其浏览器不支持客户端脚本的用户来说,该元素非常有用。
            --> 
                               
            < noscript >Your browser does not support JavaScript!</ noscript >
            <!--
              noscript 元素用来定义在脚本未被执行时的替代内容(文本)。
              此标签可被用于可识别 <script> 标签但无法支持其中的脚本的浏览器。
              注释:如果浏览器支持脚本,那么它不会显示出 noscript 元素中的文本。
              注释:无法识别 <script> 标签的浏览器会把标签的内容显示到页面上。为了避免浏览器这样做,您应当在注释标签中隐藏脚本。老式的(无法识别 <script> 标签的)浏览器会忽略注释,这样就不会把标签的内容写到页面上,而新式的浏览器则懂得执行这些脚本,即使它们被包围在注释标签中!
             -->
                               
      </ head >
      < body >
          aaa
      </ body >
  </ html >


模板实例:


1
2
3
4
5
6
7
8
9
10
11
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
< html  xmlns = "http://www.w3.org/1999/xhtml" >
< head >
< meta  http-equiv = "Content-Type"  content = "text/html; charset=UTF-8"  />
< meta  name = "keywords"  content = ""  />
< meta  name = "description"  content = ""  />
< title ></ title >
</ head >
< body >
</ body >
</ html >




      本文转自许琴 51CTO博客,原文链接:http://blog.51cto.com/xuqin/1242170,如需转载请自行联系原作者






  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值