(1)<head>元素
包含了所有的头部标签元素
(2)<titile>元素
定义了浏览器中显示的标题
<!DOCTYPE html>
<html>
<head>
<title>Title of the document</title>
</head>
<body>
The content of the document......
</body>
</html>
(3)<base>元素
定义基本的超链接地址,这样的话其他链接只用在这个url的基础上再加上其余路径就好。如果没有定义就可以使用这个作为默认
<head>
<base href="http://www.w3cschool.cc/images/" target="_blank">
</head>
(4)<link>元素
通常用来链接样式表,也就是css文件
<head>
<link rel="stylesheet" type="text/css" href="mystyle.css">
</head>
(5)<meta>元素
用来描述一些基本的元数据
1.http-equiv
看名字就知道是和http头部一样的作用,能够给浏览器传递http头部的一些有用信息。对于值,可以content中
<meta http-equiv="参数" content="参数变量值">
1)expires
可以用于设定网页的到期时间。网页一旦过期,必须到服务器上重传
<meta http-equiv="expires" content="Wed, 20 Jun 2007 22:33:00 GMT">
注意:必须使用GMT的时间格式
2)refresh
自动刷新,并能够指向新页面
<meta http-equiv="Refresh" content="2;URL=http://www.net.cn/">
也就是2秒后自动刷新到新的url网址
3)content-Type
设定页面格式和使用的字符集
<meta http-equiv="content-Type" content="text/html; charset=gb2312">
4)set-cookie
如果网页过期,就会删除保存的cookie
<meta http-equiv="Set-Cookie" content="cookievalue=xxx;expires=Wednesday, 20-Jun-2007 22:33:00 GMT; path=/">
5)keywords
给搜索引擎用的
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
6)description
页面描述
<meta http-equiv="description" content="This is my page">
2.name
主要用来定义这个html的描述、关键字、作者等。对于值,可以content中
<meta name="参数" content="参数变量值">
1)description
描述信息
<meta name="description" content="Free Web tutorials">
2)keywords
告诉搜索引擎关键字是什么
<meta name="keywords" content="HTML,CSS,JavaScript">
3)author
作者
<meta name="author" content="Hege Refsnes">
(6)<script>元素
用来在html页面中插入或引入一段javascript
1.src
用来引入一个js
1)绝对url,指向另外一个网站
<script src="http://www.example.com/example.js">
2)相对url,指向网站内的一个文件
<script src="/scripts/example.js">
2.type
<script type="text/javascript">