HTML head元素中常用标签介绍
导读
1、<title>标签定义文档的标题
title元素在所有的HTML文档中都是必须的,它定义浏览器地址栏中显示的标题,实例如下
<!DOCTYPE html> <html> <head> <title> This is my HTML</title> </head > </html>
2、<base>标签为页面上所有链接规定默认地址或默认目标(target)
<!DOCTYPE html> <html> <head> <title> This is my HTML</title> <!-- 规定默认地址--> <base href="http://www.baidu.com"></base> <!-- 规定默认目标--> <base target="_blank"></base> </head > </html>
3、<link>标签定义文档与外部资源之间的联系,它最常用于连接样式表
<!DOCTYPE html> <html> <head> <title> This is my HTML</title> <!-- 规定默认地址--> <base href="http://www.baidu.com"></base> <!-- 规定默认目标--> <base target="_blank"></base> <!-- 连接样式表--> <link rel="stylesheet" type="text/CSS" href="mystyle.css"> </head > </html>
4、<meta>元素常用于描述页面功能、关键词、文档作者、创建时间等以及一些其他信息。
<!DOCTYPE html> <html> <head> <title> This is my HTML</title> <!-- 规定默认地址--> <base href="http://www.baidu.com"></base> <!-- 规定默认目标--> <base target="_blank"></base> <!-- 连接样式表--> <link rel="stylesheet" type="text/css" href="mystyle.css"> <!-- 向浏览器传送信息,告诉浏览器这个文档的字符集类型--> <meta http-equiv="Content-Type" content="text/html;charset=gb2312" /> <!-- 文档作者--> <meta name="author" content="LiXianLi"> <!--修订时间--> <meta name="revised" content="panda,12/10/2015"> </head > </html>
5、<script>标签用于定义客户端脚本
<!DOCTYPE html>
<html>
<head>
<title> This is my HTML</title>
<!-- 规定默认地址-->
<base href="http://www.baidu.com"></base>
<!-- 规定默认目标-->
<base target="_blank"></base>
<!-- 连接样式表-->
<link rel="stylesheet" type="text/css" href="mystyle.css">
<!-- 向浏览器传送信息,告诉浏览器这个文档的字符集类型-->
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<!-- 文档作者-->
<meta name="author" content="LiXianLi">
<!--修订时间-->
<meta name="revised" content="panda,12/10/2015">
</head >
<body>
<script type="text/JavaScript">
document.write("hello world")
</script>
</body>
</html>6、<style>标签用于为HTML文档定义样式信息
<!DOCTYPE html>
<html>
<head>
<title> This is my HTML</title>
<!-- 规定默认地址-->
<base href="http://www.baidu.com"></base>
<!-- 规定默认目标-->
<base target="_blank"></base>
<!-- 连接样式表-->
<link rel="stylesheet" type="text/css" href="mystyle.css">
<!-- 向浏览器传送信息,告诉浏览器这个文档的字符集类型-->
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<!-- 文档作者-->
<meta name="author" content="LiXianLi">
<!--修订时间-->
<meta name="revised" content="panda,12/10/2015">
<!-- 定义样式信息-->
<style type="text/css">
body {background-color: green}
p {color: blue}
</style>
</head >
<body>
<script type="text/javascript">
document.write("hello world")
</script>
<p>测试脚本</p>
</body>
</html>评论(0)


