html5中<head>标签和<header>标签有什么区别

html-css06

html5中<head>标签和<header>标签有什么区别,第1张

一、指代不同

1、<head>标签:是网页的HEAD(头)部分中包含有的内置标签,用来申明使用的脚本语言,以及网页传输时使用的方式等。

2、<header>标签:header标签是HTML5新增标签元素。

二、浏览器支持不同

1、<head>标签:浏览器都支持。

2、<header>标签:旧版本浏览器均不支持,需要IE9+以上浏览器、最新谷歌Chrome等浏览器才支持。

三、支持属性不同

1、<head>标签:<head>中的元素可以引用脚本、指示浏览器在哪里找到样式表、提供元信息等等。

2、<header>标签:<header>标签支持 HTML 中的全局属性。

参考资料来源:百度百科-head标签

参考资料来源:百度百科-Header

这是HTML5的新标签,这样写语义上是表示页面布局的头部。头部就是一般放LOGO和菜单导航的部分。

IE8或以下版本都不支持HTML5,但在其他所有主流浏览器中得到支持(国内基于IE内核的浏览器除外)。

html问题,浏览器怎么设置header,简单点说,将是想用浏览器(客户端)发一个数据 。

header() 函数向客户端发送原始的 http 报头。认识到一点很重要,即必须在任何实际的输出被发送之前调用 header() 函数。

方法/步骤

1、定义和用法

header() 函数向客户端发送原始的 http 报头。

认识到一点很重要,即必须在任何实际的输出被发送之前调用 header() 函数(在 php教程 4 以及更高的版本中,您可以使用输出缓存来解决此问题):

<html>

实例一

代码如下复制代码

<?php # script 2.7 - view_tasks.php

// connect to the database:

$dbc = @mysql教程i_connect ('localhost', 'username', 'password', 'test') or die ('<p>could not connect to the database!</p></body></html>')

// get the latest dates as timestamps教程:

$q = 'select unix_timestamp(max(date_added)), unix_timestamp(max(date_completed)) from tasks'

$r = mysqli_query($dbc, $q)

list($max_a, $max_c) = mysqli_fetch_array($r, mysqli_num)

// determine the greater timestamp:

$max = ($max_a >$max_c) ? $max_a : $max_c

// create a cache interval in seconds:

$interval = 60 * 60 * 6// 6 hours

// send the header:

header ("last-modified: " . gmdate ('r', $max))

header ("expires: " . gmdate ("r", ($max + $interval)))

header ("cache-control: max-age=$interval")

?>

实例二

代码如下复制代码

<?php

// 结果出错

// 在调用 header() 之前已存在输出

header('location: http://www./')

?>语法

header(string,replace,http_response_code)

提示用户保存一个生成的 pdf 文件(content-disposition 报头用于提供一个推荐的文件名,并强制浏览器显示保存对话框):

代码如下复制代码

<?php

header("content-type:application/pdf")

// 文件将被称为 downloaded.pdf

header("content-disposition:attachmentfilename='downloaded.pdf'")

// pdf 源在 original.pdf 中

readfile("original.pdf")

?>

<html>

<body>