HTML Header 中标签的应用

来源:互联网 发布:淘宝促销时间表 编辑:程序博客网 时间:2024/05/17 12:51
1. <base> 标签为页面上的所有链接规定默认地址或默认目标。这其中包括 <a>、<img>、<link>、<form> 标签中的 URL。
<head>  <base href="http://www.w3school.com.cn/tags/">   <base target="_blank" /> <!--页面中所有target默认为_blank--></head><body>  <a href="tag_base.asp">base </a> <br> <!--实际指向http://www.w3school.com.cn/tags/tag_base.asp 且target为_blank -->  <a href="tag_audio.asp">audio </a></body>

target可选的属性:
_blank
_parent
_self
_top


2. <link>标签定义文档与外部资源的关系。最常见的用途是链接样式表。
<head><link rel="stylesheet" type="text/css" href="theme.css" /><link rel="shortcut icon" href="http://jquery.com/jquery-wp-content/themes/jquery.com/i/favicon.ico"></head>

rel 可选的属性有:
alternate
author
help
icon
licence
next
pingback
prefetch
prev
search
sidebar
stylesheet
tag


3. <meta> 定义了与文档相关联的名称/值对,比如针对搜索引擎和更新频度的描述和关键词。 <meta>标签没有结束标签,但必须被正确地被关闭(<meta ...  />)。
<head><meta http-equiv="Content-Type"  Content="text/html; charset=UTF-8" /><meta name="keywords" content="HTML,ASP,PHP,SQL"></head>

属性:
属性值描述nameauthor, description, keywords, generator, revised提供了名称/值对中的名称。最常用到的是"keywords",它为搜索引擎提供关键字http-equivcontent-type, expires, refresh, set-cookie为名称/值对提供了名称。并指示服务器在发送实际的文档之前先在要传送给浏览器的 MIME 文档头部包含名称/值对。服务器都至少要发送一个:content-type:text/html,这将告诉浏览器准备接受一个 HTML 文档。content属性提供了名称/值对中的值。该值可以是任何有效的字符串。它始终要和 name 属性或 http-equiv 属性一起使用。


4.<style>为 HTML 文档定义样式信息.
<head><style type="text/css">h1 {color:red}p {color:blue}</style><link rel="stylesheet" type="text/css" href="/c5.css" /></head>



5. <title> 元素可定义文档的标题。 它是 <head> 标签中唯一要求包含的东西。


原创粉丝点击