博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
html中header结构详解
阅读量:7090 次
发布时间:2019-06-28

本文共 3886 字,大约阅读时间需要 12 分钟。

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,如需转载请自行联系原作者

你可能感兴趣的文章
Kettle学习系列之数据仓库、数据整合、ETL、ELT和EII之间的区别?
查看>>
把握linux内核设计思想系列
查看>>
zoj1003 Crashing Balloon
查看>>
在EA中将画出的ER图转换成SQL脚本
查看>>
Android Studio怎样删除module
查看>>
selective search生成.mat文件
查看>>
POJ2823 Sliding Window【双端队列】
查看>>
ssh-remote-port-forwarding
查看>>
System V IPC(1)-消息队列
查看>>
51单片机GPIO口模拟串口通信
查看>>
信息、数据与数据结构
查看>>
Webpack 2 视频教程 020 - Webpack 2 中的 HMR ( Hot Module Replacement )
查看>>
Android 高亮指示层提示
查看>>
Spark MLlib中的OneHot哑变量实践
查看>>
淘宝npm镜像使用方法
查看>>
Tomcat禁用SSLv3和RC4算法
查看>>
面向对象葵花宝典阅读思维导图(一)
查看>>
Tomcat Server.xml详解
查看>>
CSS媒体查询(@media)
查看>>
Linux(Ubuntu)下MySQL的安装与配置
查看>>