当前位置: 移动技术网 > IT编程>网页制作>CSS > head头部包裹title,base,link,meta,script,style

head头部包裹title,base,link,meta,script,style

2020年03月28日  | 移动技术网IT编程  | 我要评论

html头部<head>元素包含关于文档的概要信息,也被称为元信息(meta-information)

  1. <head> 元素包含了所有的头部标签元素。在 <head>元素中你可以插入脚本(scripts), 样式文件(css),及各种 meta 信息。
  2. 可以添加在头部区域的元素标签为: <title>, <style>, <meta>, <link>, <script>, <noscript> 和 <base>。
  3. <head> 元素描述了文档的各种属性和信息,其中包括文档的标题、在 web 中的位置以及和其他文档的关系等。

html <title> 元素/<title> 标签定义了不同文档的标题,<title> 在 html/xhtml 文档中是必须的(代码部分为一个简单的html文档)

  • <title> 元素定义了浏览器工具栏的标题
  • 当网页添加到收藏夹时,显示在收藏夹中的标题
  • 显示在搜索引擎结果页面的标题
1 <!doctype html>      
2 <html>        
3 <head>        
4 <title>title of the document</title>        
5 </head>                
6 <body>       
7 the content of the document......        
8 </body>                
9 </html>

html <base> 元素/<base> 标签描述了基本的链接地址/链接目标,该标签作为html文档中所有的链接标签的默认链接,在 html 中,<base> 标签没有结束标签;在 xhtml 中,<base> 标签必须被正确地关闭

1 <head>       
2 <base href="https://www.cnblogs.com/dhnblog/" target="_blank">      
3 </head>

html <link> 元素/<link> 标签定义了文档与外部资源之间的关系,<link> 标签通常用于链接到样式表:

1 <head>       
2 <link rel="stylesheet" type="text/css" href="mystyle.css">        
3 </head>

html <style> 元素/<style> 标签定义了html文档的样式文件引用地址,在<style> 元素中你需要指定样式文件来渲染html文档:

1 <head>        
2 <style type="text/css">        
3 body {background-color:yellow}        
4 p {color:blue}        
5 </style>        
6 </head>

html <meta> 元素/meta标签描述了一些基本的元数据;<meta> 标签提供了元数据。元数据也不显示在页面上,但会被浏览器解析;meta元素通常用于指定网页的描述,关键词,文件的最后修改时间,作者,和其他元数据;元数据可以使用于浏览器(如何显示内容或重新加载页面),搜索引擎(关键词),或其他web服务;<meta>一般放置于 <head>区域

<meta> 标签- 使用实例:

1 为搜索引擎定义关键词:
2 <meta name="keywords" content="html, css, xml, xhtml, javascript">
3 为网页定义描述内容:
4 <meta name="description" content="free web tutorials on html and css">
5 定义网页作者:
6 <meta name="author" content="hege refsnes">

每30秒钟刷新当前页面:

1 <meta http-equiv="refresh" content="30">

html <script> 元素,<script>标签用于加载脚本文件,如: javascript

html head 元素如图:

如对本文有疑问, 点击进行留言回复!!

相关文章:

验证码:
移动技术网