"; 2. ""; 3. "<base>"; 4. "<link>"; 5. "<style>"; 6. " <meta>"; 7. "<script>"; 8. "<noscript>"."/><meta property="og:local" content="faq"> <meta property="og:title" content="What are the head tags of html5-Front-end Q&A-php.cn"> <meta property="og:description" content="The head tags of html5 are: 1. "<head>"; 2. "<title>"; 3. "<base>"; 4. "<link>"; 5. "<style>"; 6. " <meta>"; 7. "<script>"; 8. "<noscript>"."> <meta property="og:url" content="https://m.php.cn/faq/486099.html"> <meta property="og:image" content="https://img.php.cn/upload/article/202112/17/2021121711215988732.jpg"> <meta property="og:site_name" content="php.cn"> <meta property="og:type" content="website"> <link rel="canonical" href="https://www.php.cn/faq/486099.html"/> <link rel="alternate" hrefLang="zh-cn" href="https://m.php.cn/zh/faq/486099.html" /> <link rel="alternate" hrefLang="en" href="https://m.php.cn/faq/486099.html" /> <link rel="alternate" hrefLang="zh-tw" href="https://m.php.cn/zh-tw/faq/486099.html" /> <link rel="alternate" hrefLang="ja" href="https://m.php.cn/ja/faq/486099.html" /> <link rel="alternate" hrefLang="ko" href="https://m.php.cn/ko/faq/486099.html" /> <link rel="alternate" hrefLang="ms" href="https://m.php.cn/ms/faq/486099.html" /> <link rel="alternate" hrefLang="fr" href="https://m.php.cn/fr/faq/486099.html" /> <link rel="alternate" hrefLang="de" href="https://m.php.cn/de/faq/486099.html" /> <meta charset="utf-8" /><meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=5, user-scalable=1" /><meta name="applicable-device" content="mobile" /><link rel="stylesheet" href="/static/css/style.css?4.5.31"><link href="/static/front/mobcss/newphpcommon.css?1.1" type="text/css" rel="stylesheet"/><link href="/static/front/mobcss/swiper.min.css" type="text/css" rel="stylesheet"/><link href="/static/front/mobcss/newphp.css?1.2" type="text/css" rel="stylesheet"/><link href="/static/css/global.css" type="text/css" rel="stylesheet"/><link href="/static/layui/css/layui.css" type="text/css" rel="stylesheet"/><link href="/static/mobcss/mobindex3.css" type="text/css" rel="stylesheet"/><script src="/static/front/mobjs/jquery-1.6.1.min.js"></script><script src="/static/front/mobjs/swiper.min.js"></script><script src="/static/front/mobjs/newphpcommon.js"></script><link rel="canonical" href="https://www.php.cn/faq/486099.html"/> <link rel="alternate" hrefLang="zh-cn" href="https://m.php.cn/zh/faq/486099.html" /> <link rel="alternate" hrefLang="en" href="https://m.php.cn/faq/486099.html" /> <link rel="alternate" hrefLang="zh-tw" href="https://m.php.cn/zh-tw/faq/486099.html" /> <link rel="alternate" hrefLang="ja" href="https://m.php.cn/ja/faq/486099.html" /> <link rel="alternate" hrefLang="ko" href="https://m.php.cn/ko/faq/486099.html" /> <link rel="alternate" hrefLang="ms" href="https://m.php.cn/ms/faq/486099.html" /> <link rel="alternate" hrefLang="fr" href="https://m.php.cn/fr/faq/486099.html" /> <link rel="alternate" hrefLang="de" href="https://m.php.cn/de/faq/486099.html" /> <script> var canshu = { SeeMore:'See more', FoldUp:'Fold up', Choice:'LANGUAGE', wait:'Loading, please wait~', LoginFirst:"Please log in first", needKeyword:'Enter keyword search', emailPhoneError:'Please enter the correct phone or email address', missPwd:'Please enter the password', emailError:'Please enter your correct email address', VerCode:"Please enter the verification code", getCode:'Sending', pwdError:'Incorrect password format', TwoPassNotMatch:'Two passwords do not match', Bindemail:'Bind email', resetpassword:'reset password', ConfirmPass:'Confirm Password', pwdCheck:'Please enter 6-18 letters or numbers', Editinfor: 'Edit personal information', trimContent:'Please enter content', titleCheck:'Title should be at least 5 words long', choiceLang:'Please select a language classification', Secondreply:'reply', NetWorkError:'Network error, please try again later!', keywordSearch:'Enter keyword search', all_lang_string:'zh|en|zh-tw|ja|ko|ms|fr|de', Next:'Next', Previous:'Previous' }; </script><!-- Google Tag Manager --><script> (function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start': new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0], j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src= 'https://www.googletagmanager.com/gtm.js?id='+i+dl; f.parentNode.insertBefore(j,f); })(window,document,'script','dataLayer','GTM-WWVXRJPW'); </script><!-- End Google Tag Manager --><!-- Google tag (gtag.js) --><script async src="https://www.googletagmanager.com/gtag/js?id=G-H42EVCYBJC"></script><script> window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'G-H42EVCYBJC'); </script><script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-5902227090019525" crossorigin="anonymous"></script><!--<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-6267705206177514" crossorigin="anonymous"></script>--><script type="application/ld+json">{"@context":"https:\/\/schema.org","@type":"WebSite","url":"https:\/\/m.php.cn\/","potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/m.php.cn\/search?word={search_term_string}"},"query-input":"required name=search_term_string"}}</script><meta property="article:author" content="青灯夜游" /><meta property="article:published_first" content=",https://www.php.cn/faq/486099.html" /><link rel="stylesheet" href="/static/ueditor/third-party/SyntaxHighlighter/shCoreDefault.css?1"><link rel="stylesheet" href="/static/ueditor/third-party/SyntaxHighlighter/shCoreDefault1.css"><link href="/static/mobcss/newphp.css" type="text/css" rel="stylesheet"/><script src="/static/ueditor/third-party/SyntaxHighlighter/shCore.js"></script><script type="text/javascript" src="/static/layui/layui.js"></script><script type="text/javascript" src="/static/js/global.js?4.9.47"></script><script> var xnb_name = 'Virtual currency'; </script><script type="application/ld+json">{"@context":"https:\/\/schema.org","@type":"Article","headline":"What are the head tags of html5","description":"The head tags of html5 are: 1. \"<head>\"; 2. \"<title>\"; 3. \"<base>\"; 4. \"<link>\"; 5. \"<style>\"; 6. \" <meta>\"; 7. \"<script>\"; 8. \"<noscript>\".","image":["https:\/\/img.php.cn\/upload\/article\/202112\/17\/2021121711215988732.jpg?x-oss-process=image\/resize,p_40"],"datePublished":"2021-12-17T11:24:47+8:00","author":{"url":"https:\/\/m.php.cn\/member\/287557.html","name":"青灯夜游"},"mainEntityOfPage":{"@type":"WebPage","@id":"https:\/\/m.php.cn\/faq\/486099.html"},"url":"https:\/\/m.php.cn\/faq\/486099.html","articleBody":"<blockquote>\n<p>html5的头部标记有:1、“<\/p>”;2、“<title>”;3、“<base>”;4、“<link>”;5、“<style>”;6、“<meta>”;7、“<script>”;8、“<noscript>”。<\/style>\n<\/title>\n<\/blockquote>\n<p><img src=\"https:\/\/img.php.cn\/upload\/article\/202112\/17\/2021121711215988732.jpg?x-oss-process=image\/resize,p_40\" alt=\"What are the head tags of html5\" ><\/p>\n<p>本教程操作环境:windows7系统、HTML5版、Dell G3电脑。<\/p>\n<h2><strong>html5的头部标记<\/strong><\/h2>\n<p><strong>1、标签<\/strong><\/p>\n<p><\/p> 标签是所有头部标签的容器,这些头部标签用来定义有关 HTML 文档的元数据(描述数据的数据)以及所需资源的引用(例如 CSS 样式文件、JavaScript 脚本文件),对文档能够在浏览器中正确显示起到了非常重要的作用。根据我们的需求,可以在 HTML 头部定义大量的元数据,也可以定义很少或者根本就不定义。虽然头部标签是 HTML 文档的一部分,但其中的内容并不会显示在浏览器中。<pre class='brush:php;toolbar:false;'><head>\n    ....\n<\/head><\/pre><p><strong>2、<title> 标签<\/title><\/strong><\/p>\n<p><\/p>\n<title> 标签用来定义 HTML 文档的标题,只有包含 <title> 标签的文档才算是一个有效的 HTML 文档。另外,一个 HTML 文档中仅允许存在一个 <title> 标签,并且 <title> 标签必须放置在 标签中。<p>注意,在 <\/p>\n<title> 标签内部仅允许包含纯文本内容,不能包含其他 HTML 标签。<p><\/p>\n<title> 标签的主要作用如下所示:<ul style=\"list-style-type: disc;\">\n<li><p>在浏览器标题栏或者任务栏中显示标题;<\/p><\/li>\n<li><p>当将页面添加到收藏夹(书签)时提供标题;<\/p><\/li>\n<li><p>在搜索结果中显示页面标题。<\/p><\/li>\n<\/ul>\n<p>下面的示例演示了如何在 HTML 文档中使用 <\/p>\n<title> 标签:<pre class='brush:php;toolbar:false;'><head>\n    <meta charset=\"utf-8\">\n    <title>php中文网-教程_手册_视频-免费php在线学习平台<\/title>\n<\/head><\/pre><p><\/p>\n<title> 标签的内容必须与当前文档有关,并且不应该过长,中文页面请尽量控制在 30 个字符(包括空格)以内。<p><strong>3、<base> 标签<\/strong><\/p>\n<p><base> 标签用于为页面中所有相对链接指定一个基本链接,当您设置了基本链接后,当前页面中的所有相对链接都会使用这个基本链接作为前缀,如下例所示:<\/p><pre class='brush:php;toolbar:false;'><!DOCTYPE html>\n<html>\n<head>\n    <meta charset=\"utf-8\">\n    <title><base>标签演示<\/title>\n    <base href=\"https:\/\/www.php.cn\/\">\n<\/head>\n<body>\n    <ul>\n        <li><a href=\"course.html\">视频教程<\/a><\/li>\n        <li><a href=\"course\/type\/3.html\">入门教程<\/a><\/li>\n    <\/ul>\n<\/body>\n<\/html><\/pre><p>上面的示例中第一个 <\/p>\n<li> 标签中的超链接会被解析为“https:\/\/www.php.cn\/course.html”,第二个 <\/li>\n<li> 中的超链接会被解析为“https:\/\/www.php.cn\/course\/type\/3.html”。<p>注意,HTML 文档中的 <base> 标签必须出现在任何引用外部资源的标签之前,而且一个 HTML 文档中仅允许定义一个 <base> 标签。<\/p>\n<p><strong>4、<link> 标签<\/strong><\/p>\n<p><link> 标签经常用于引用外部 CSS 样式表,<link> 标签中包含两个主要的属性,分别是 rel 和 href。rel 属性用来指示引用文件的类型,href 属性用来设置外部文件的路径。示例代码如下:<\/p><pre class='brush:php;toolbar:false;'><head>\n    <title>此处书写标题<\/title>\n    <link rel=\"stylesheet\" href=\"common.css\">\n<\/head><\/pre><p>HTML <\/p> 标签中可以包含任意数量的 <link> 标签。<p><strong>5、<style>标签<\/style><\/strong><\/p>\n<p>使用 <style> 标签可以在 HTML 文档中嵌入 CSS 样式,需要注意的是在 <style> 标签中定义的样式仅对当前 HTML 文档有效。示例代码如下:<\/style><\/p><pre class='brush:php;toolbar:false;'><head>\n    <title>此处书写标题<\/title>\n    <style>\n        body { background-color: YellowGreen; }\n        h1 { color: red; }\n        p { color: green; }\n    <\/style>\n<\/head><\/pre><p>注意:对于文档中的唯一样式可以使用 <style> 标签,但对于在多个文档中通用的样式,使用外部样式表更为合适。关于在 HTML 中嵌入 CSS 的更多内容,请转到《HTML嵌入CSS样式(四种方法)》。<\/style><\/p>\n<p><strong>6、<meta> 标签<\/strong><\/p>\n<p><meta> 标签用于提供有关 HTML 文档的元数据,例如页面有效期、页面作者、关键字列表、页面描述等信息。<meta> 标签定义的数据并不会显示在页面上,但却会被浏览器解析。<\/p>\n<p>1) 定义字符集<\/p><pre class='brush:php;toolbar:false;'><meta charset=\"UTF-8\"><\/pre><p>charset 属性用来指定 HTML 文档的字符编码,上面的示例中,我们将文档的字符编码设置为了“UTF-8”。<\/p>\n<p>2) 定义页面描述<\/p><pre class='brush:php;toolbar:false;'><meta name=\"description\" content=\"php中文网提供大量免费、原创、高清的php视频教程,并定期举行公益php培训!可边学习边在线修改示例代码,查看执行效果!php从入门到精通,一站式php自学平台!\"><\/pre><p>定义页面的描述信息有利于搜索引擎的搜索。<\/p>\n<blockquote>\n<p><\/p>\n<title> 标签定义文档标题,name=\"description\" 定义文档描述,描述的长度通常大于标题。<\/title>\n<\/blockquote>\n<p>3) 定义关键字<\/p><pre class='brush:php;toolbar:false;'><meta name=\"keywords\" content=\"php教程,php入门教程,php视频教程,php源码下载,php手册\"><\/pre><p>关键字用于为搜索引擎提供与页面有关的信息。<\/p>\n<p>4) 定义页面作者<\/p><pre class='brush:php;toolbar:false;'><meta name=\"author\" content=\"PHP中文网\"><\/pre><p>通过某些内容管理系统可以自动提取作者信息。<\/p>\n<p>5) 刷新页面<\/p><pre class='brush:php;toolbar:false;'><meta http-equiv=\"refresh\" content=\"30\"><\/pre><p>上例中的代码用于向浏览器发送一个指令,使浏览器在经过指定的时间间隔(30 秒)后自动刷新页面。在 content 属性中除了可以指定时间间隔外,还可以再指定一个链接,这时页面将在指定的时间后重定向到链接所指向的页面,如下例所示:<\/p><pre class='brush:php;toolbar:false;'><meta http-equiv=\"refresh\" content=\"10; url=https:\/\/www.php.cn\/\"><\/pre><p><strong>7、<script> 标签<\/script><\/strong><\/p>\n<p><script> 标签用于定义 JavaScript 脚本,示例代码如下:<\/script><\/p><pre class='brush:php;toolbar:false;'><head>\n    <title>PHP中文网<\/title>\n    <script>\n        document.write(\"PHP中文网\")\n    <\/script>\n<\/head><\/pre><p><strong>8、<noscript> 标签<\/noscript><\/strong><\/p>\n<p>当用户的浏览器不支持 JavaScript 脚本或者禁用 JavaScript 脚本时,可以在 <noscript> 标签中定义一些内容来替代不能运行的 JavaScript 脚本或者给用户一些提示。除了 <script> 标签外,在 <noscript> 标签中可以包含任何 HTML 元素,如下例所示:<\/script>\n<\/noscript><\/p><pre class='brush:php;toolbar:false;'><head>\n    <title>PHP中文网<\/title>\n    <noscript>\n        <p>您的浏览器不支持 JavaScript 或者您禁用了 JavaScript,请<a href=\"https:\/\/www.php.cn\/\">点击这里<\/a>了解如何启用 JavaScript。<\/p>\n    <\/noscript>\n<\/head><\/pre><p>相关推荐:《<a href=\"http:\/\/www.php.cn\/course\/list\/11.html\" target=\"_blank\" textvalue=\"html视频教程\">html视频教程<\/a>》<\/p>\n<\/li>\n<\/title>\n<\/title>\n<\/title>\n<\/title>\n<\/title>\n<\/title>\n<\/title>\n<\/title>"}</script><script type="application/ld+json">{"@context":"https:\/\/schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"item":{"@id":"https:\/\/m.php.cn\/","name":"Home"}},{"@type":"ListItem","position":2,"item":{"@id":"https:\/\/m.php.cn\/web-designer.html","name":"Web Front-end"}},{"@type":"ListItem","position":3,"item":{"@id":"https:\/\/m.php.cn\/website-design-ask.html","name":"Front-end Q&A"}},{"@type":"ListItem","position":4,"item":{"@id":"https:\/\/m.php.cn\/faq\/486099.html","name":"What are the head tags of html5"}}]}</script></head><body data-commit-time="2023-12-28T14:50:12+08:00" class="body2_2"><link rel="stylesheet" type="text/css" href="/static/csshwm/m_stylehw.css"><header><div class="head"><div class="haed_left"><div class="haed_logo"><a href="https://m.php.cn/" title="php.cn" class="haed_logo_a"><img src="/static/imghwm/logo.png" alt="php.cn" class="haed_logoimg"></a></div></div><div class="search_div search_div_top2"><input id="key_words" class="search-input" type="text" autocomplete="off" name="keywords" required="required" placeholder="Block,address,transaction,news" value="" onkeydown="if (event.keyCode == 13) searchs('en')"/><a onclick="searchs('en')" href="javascript:;" title="search"><img onerror="this.onerror=''; this.src='static/imghwm/default1.png'" src="/static/imghwm/find.png" alt="search"></a></div><div class="head_right"><button type="button" class="layui-btn layui-btn-primary headerlan headlanmax lan1" id="lan1sp" lay-on="test-offset-r"><img src="/static/imghwm/m_menu.png" alt=""></button><div id="m_menu" class="m_menu" style="display: none;"><div class="m_editormain12main_top"><img src="/static/imghwm/logo.png" alt="logo"><a href="javascript:;" class="m_editormain12main_topi" id="m_editormain12main_topi_sp"><i class="layui-icon layui-icon-close"></i></a></div><div class="layui-panel m_menu_main"><ul class="layui-menu" id="demo-menu"><li class="layui-menu-item-group layui-menu-item-up m_menus" lay-options="{type: 'group'}"><div class="layui-menu-body-title m_menus_title">Community<i class="layui-icon layui-icon-down"></i></div><ul class="m_menusnames"><li><div class="layui-menu-body-title m_menus_name"><a href="https://m.php.cn/article.html" title="Articles">Articles</a></div></li><li><div class="layui-menu-body-title m_menus_name"><a href="https://m.php.cn/faq/zt" title="Topics">Topics</a></div></li><li><div class="layui-menu-body-title m_menus_name"><a href="https://m.php.cn/wenda.html" title="Q&A">Q&A</a></div></li></ul></li><li class="layui-menu-item-divider"></li><li class="layui-menu-item-group layui-menu-item-up m_menus" lay-options="{type: 'group'}"><div class="layui-menu-body-title m_menus_title">Learn<i class="layui-icon layui-icon-down"></i></div><ul class="m_menusnames"><li><div class="layui-menu-body-title m_menus_name"><a href="https://m.php.cn/course.html" title="Course">Course</a></div></li><li><div class="layui-menu-body-title m_menus_name"><a href="https://m.php.cn/dic/29.html" title="Programming Dictionary">Programming Dictionary</a></div></li></ul></li><li class="layui-menu-item-divider"></li><li class="layui-menu-item-group layui-menu-item-up m_menus" lay-options="{type: 'group'}"><div class="layui-menu-body-title m_menus_title">Tools Library<i class="layui-icon layui-icon-down"></i></div><ul class="m_menusnames"><li><div class="layui-menu-body-title m_menus_name"><a href="https://m.php.cn/toolset/development-tools" title="Development tools">Development tools</a></div></li><li><div class="layui-menu-body-title m_menus_name"><a href="https://m.php.cn/toolset/website-source-code" title="Website Source Code">Website Source Code</a></div></li><li><div class="layui-menu-body-title m_menus_name"><a href="https://m.php.cn/toolset/php-libraries" title="PHP Libraries">PHP Libraries</a></div></li><li><div class="layui-menu-body-title m_menus_name"><a href="https://m.php.cn/toolset/js-special-effects" title="JS special effects">JS special effects</a></div></li><li><div class="layui-menu-body-title m_menus_name"><a href="https://m.php.cn/toolset/website-materials" title="Website Materials">Website Materials</a></div></li><li><div class="layui-menu-body-title m_menus_name"><a href="https://m.php.cn/toolset/extension-plug-ins" title="Extension plug-ins">Extension plug-ins</a></div></li></ul></li><li class="layui-menu-item-divider"></li><li lay-options="{id: 100}"><div class="layui-menu-body-title m_menus_oth"><a href="https://m.php.cn/ai" title="AI Tools">AI Tools</a></div></li><li class="layui-menu-item-divider"></li><li class="layui-menu-item-group layui-menu-item-up m_menus" lay-options="{type: 'group'}"><div class="layui-menu-body-title m_menus_title">Leisure<i class="layui-icon layui-icon-down"></i></div><ul class="m_menusnames"><li><div class="layui-menu-body-title m_menus_name"><a href="https://m.php.cn/game" title="Game Download">Game Download</a></div></li><li><div class="layui-menu-body-title m_menus_name"><a href="https://m.php.cn/mobile-game-tutorial/" title="Game Tutorials">Game Tutorials</a></div></li></ul></li><li class="layui-menu-item-divider"></li></ul></div><!-- <div class="m_menu_button">--><!-- <a href="javascript:;" title="singup">Create an account</a>--><!-- </div>--><div class="m_menu_button m_menu_button_login"><a href="https://m.php.cn/login" title="Login">Log in</a></div><div class="m_menu_button m_menu_button_lang"><button type="button" class="layui-btn layui-btn-primary headerlan headlanmax lan1" id="lan1" lay-on="page2">English<i class="layui-icon layui-icon-triangle-d"></i></button></div></div><div class="m_menu_lang" id="m_menu_lang" style="display: none;"><div class="m_editormain12main_top"><img src="/static/imghwm/logo.png" alt="logo"><a href="javascript:;" class="m_editormain12main_topi" id="m_editormain12main_topi_lan"><i class="layui-icon layui-icon-close"></i></a></div><div class="m_menu_lang_main"><a href="javascript:setlang('zh-cn');" class="m_menu_lang_mains">简体中文<span>zh-cn</span></a><a href="javascript:;" class="m_menu_lang_mains">English<span>en</span></a><a href="javascript:setlang('zh-tw');" class="m_menu_lang_mains">繁体中文<span>zh-tw</span></a><a href="javascript:setlang('ja');" class="m_menu_lang_mains">日本語<span>ja</span></a><a href="javascript:setlang('ko');" class="m_menu_lang_mains">한국어<span>ko</span></a><a href="javascript:setlang('ms');" class="m_menu_lang_mains">Melayu<span>ms</span></a><a href="javascript:setlang('fr');" class="m_menu_lang_mains">Français<span>fr</span></a><a href="javascript:setlang('de');" class="m_menu_lang_mains">Deutsch<span>de</span></a></div></div></div></div></header><script> document.getElementById('lan1sp').addEventListener('click', function (event) { event.preventDefault(); var elements = document.getElementsByClassName('m_menu'); for (var i = 0; i < elements.length; i++) { elements[i].style.display = 'block'; } }); document.getElementById('m_editormain12main_topi_sp').addEventListener('click', function (event) { event.preventDefault(); var elements = document.getElementsByClassName('m_menu'); for (var i = 0; i < elements.length; i++) { elements[i].style.display = 'none'; } }); document.getElementById('lan1').addEventListener('click', function (event) { event.preventDefault(); var elements = document.getElementsByClassName('m_menu_lang'); for (var i = 0; i < elements.length; i++) { elements[i].style.display = 'block'; } }); document.getElementById('m_editormain12main_topi_lan').addEventListener('click', function (event) { event.preventDefault(); var elements = document.getElementsByClassName('m_menu_lang'); for (var i = 0; i < elements.length; i++) { elements[i].style.display = 'none'; } }); </script><main class="m_phpTopic_Details m_phpArticle_Details"><div class="fixed_tab"><a href="" title="" class="fixed_tab_img" id="fixed_tab_img"><img class="lazy" data-src="/static/imghwm/tab_tab.png" src="/static/imghw/default1.png" alt="" /></a></div><div class="m_editormain12main" style="display: none" id="fixed_tab_titlelist"><div class="m_editormain12main_top"><img class="lazy" data-src="/static/imghwm/logo.png" src="/static/imghw/default1.png" alt="logo" /><a href="" title="" title="" class="m_editormain12main_topi" id="fixed_tab_topi"><i class="layui-icon layui-icon-close"></i></a></div><div class="phpeditormainL"><div class="fixed_tab_as"><ul><li><span></span><a href="#strong-html-的头部标记-strong" title="<strong>html5的头部标记</strong>" class="fixed_tab_a"><strong>html5的头部标记</strong></a></li></ul></div><div class="m_editormain12_close"><a href="" title="" title="" id="fixed_tab_close">close</a></div></div></div><div class="Article_Details_main1M"><div class="phpgenera_Details_mainL1"><a href="https://m.php.cn/" title="Home" class="phpgenera_Details_mainL1a">Home</a><img class="lazy" data-src="/static/imghwm/top_right.png" src="/static/imghw/default1.png" alt="" /><a href="https://m.php.cn/web-designer.html" class="phpgenera_Details_mainL1a">Web Front-end</a><img class="lazy" data-src="/static/imghwm/top_right.png" src="/static/imghw/default1.png" alt="" /><a href="https://m.php.cn/website-design-ask.html" class="phpgenera_Details_mainL1a">Front-end Q&A</a><img class="lazy" data-src="/static/imghwm/top_right.png" src="/static/imghw/default1.png" alt="" /><span>What are the head tags of html5</span></div><div class="Articlelist_txts"><div class="Articlelist_txts_info"><h1><a href="" title="" class="Articlelist_txts_title">What are the head tags of html5</a></h1><div class="Articlelist_txts_info_head"><div class="author_info"><a href="https://m.php.cn/member/287557.html" class="author_avatar"><img class="lazy" data-src="https://img.php.cn/upload/avatar/000/287/557/5bef70171e9f3249.jpg" alt="青灯夜游" src="/static/imghw/default1.png" alt="author avatar" onerror="this.onerror=''; this.src='/static/imghw/default1.png'"></a><div class="author_detail"><a href="https://m.php.cn/member/287557.html" class="author_name">青灯夜游</a></div></div></div><span class="Articlelist_txts_time">Dec 17, 2021 am 11:24 AM</span><div class="Articlelist_txts_infos"><span class="Articlelist_txts_infoss on">html5</span></div></div></div><hr /><div class="article_main wenda-list"><blockquote> <p>html5的头部标记有:1、“</p>”;2、“<title>”;3、“<base>”;4、“<link>”;5、“<style>”;6、“<meta>”;7、“<script>”;8、“<noscript>”。</style> </title> </blockquote> <p><img src="/static/imghwm/default1.png" data-src="https://img.php.cn/upload/article/202112/17/2021121711215988732.jpg?x-oss-process=image/resize,p_40" class="lazy" alt="What are the head tags of html5" ></p> <p>本教程操作环境:windows7系统、HTML5版、Dell G3电脑。</p> <h2 id="strong-html-的头部标记-strong"><strong>html5的头部标记</strong></h2> <p><strong>1、标签</strong></p> <p></p> 标签是所有头部标签的容器,这些头部标签用来定义有关 HTML 文档的元数据(描述数据的数据)以及所需资源的引用(例如 CSS 样式文件、JavaScript 脚本文件),对文档能够在浏览器中正确显示起到了非常重要的作用。根据我们的需求,可以在 HTML 头部定义大量的元数据,也可以定义很少或者根本就不定义。虽然头部标签是 HTML 文档的一部分,但其中的内容并不会显示在浏览器中。<pre class='brush:php;toolbar:false;'>&lt;head&gt; .... &lt;/head&gt;</pre><p><strong>2、<title> 标签</title></strong></p> <p></p> <title> 标签用来定义 HTML 文档的标题,只有包含 <title> 标签的文档才算是一个有效的 HTML 文档。另外,一个 HTML 文档中仅允许存在一个 <title> 标签,并且 <title> 标签必须放置在 标签中。<p>注意,在 </p> <title> 标签内部仅允许包含纯文本内容,不能包含其他 HTML 标签。<p></p> <title> 标签的主要作用如下所示:<ul style="list-style-type: disc;"> <li><p>在浏览器标题栏或者任务栏中显示标题;</p></li> <li><p>当将页面添加到收藏夹(书签)时提供标题;</p></li> <li><p>在搜索结果中显示页面标题。</p></li> </ul> <p>下面的示例演示了如何在 HTML 文档中使用 </p> <title> 标签:<pre class='brush:php;toolbar:false;'>&lt;head&gt; &lt;meta charset=&quot;utf-8&quot;&gt; &lt;title&gt;php中文网-教程_手册_视频-免费php在线学习平台&lt;/title&gt; &lt;/head&gt;</pre><p></p> <title> 标签的内容必须与当前文档有关,并且不应该过长,中文页面请尽量控制在 30 个字符(包括空格)以内。<p><strong>3、<base> 标签</strong></p> <p><base> 标签用于为页面中所有相对链接指定一个基本链接,当您设置了基本链接后,当前页面中的所有相对链接都会使用这个基本链接作为前缀,如下例所示:</p><pre class='brush:php;toolbar:false;'>&lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head&gt; &lt;meta charset=&quot;utf-8&quot;&gt; &lt;title&gt;&lt;base&gt;标签演示&lt;/title&gt; &lt;base href=&quot;https://www.php.cn/&quot;&gt; &lt;/head&gt; &lt;body&gt; &lt;ul&gt; &lt;li&gt;&lt;a href=&quot;course.html&quot;&gt;视频教程&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href=&quot;course/type/3.html&quot;&gt;入门教程&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; &lt;/body&gt; &lt;/html&gt;</pre><p>上面的示例中第一个 </p> <li> 标签中的超链接会被解析为“https://www.php.cn/course.html”,第二个 </li> <li> 中的超链接会被解析为“https://www.php.cn/course/type/3.html”。<p>注意,HTML 文档中的 <base> 标签必须出现在任何引用外部资源的标签之前,而且一个 HTML 文档中仅允许定义一个 <base> 标签。</p> <p><strong>4、<link> 标签</strong></p> <p><link> 标签经常用于引用外部 CSS 样式表,<link> 标签中包含两个主要的属性,分别是 rel 和 href。rel 属性用来指示引用文件的类型,href 属性用来设置外部文件的路径。示例代码如下:</p><pre class='brush:php;toolbar:false;'>&lt;head&gt; &lt;title&gt;此处书写标题&lt;/title&gt; &lt;link rel=&quot;stylesheet&quot; href=&quot;common.css&quot;&gt; &lt;/head&gt;</pre><p>HTML </p> 标签中可以包含任意数量的 <link> 标签。<p><strong>5、<style>标签</style></strong></p> <p>使用 <style> 标签可以在 HTML 文档中嵌入 CSS 样式,需要注意的是在 <style> 标签中定义的样式仅对当前 HTML 文档有效。示例代码如下:</style></p><pre class='brush:php;toolbar:false;'>&lt;head&gt; &lt;title&gt;此处书写标题&lt;/title&gt; &lt;style&gt; body { background-color: YellowGreen; } h1 { color: red; } p { color: green; } &lt;/style&gt; &lt;/head&gt;</pre><p>注意:对于文档中的唯一样式可以使用 <style> 标签,但对于在多个文档中通用的样式,使用外部样式表更为合适。关于在 HTML 中嵌入 CSS 的更多内容,请转到《HTML嵌入CSS样式(四种方法)》。</style></p> <p><strong>6、<meta> 标签</strong></p> <p><meta> 标签用于提供有关 HTML 文档的元数据,例如页面有效期、页面作者、关键字列表、页面描述等信息。<meta> 标签定义的数据并不会显示在页面上,但却会被浏览器解析。</p> <p>1) 定义字符集</p><pre class='brush:php;toolbar:false;'>&lt;meta charset=&quot;UTF-8&quot;&gt;</pre><p>charset 属性用来指定 HTML 文档的字符编码,上面的示例中,我们将文档的字符编码设置为了“UTF-8”。</p> <p>2) 定义页面描述</p><pre class='brush:php;toolbar:false;'>&lt;meta name=&quot;description&quot; content=&quot;php中文网提供大量免费、原创、高清的php视频教程,并定期举行公益php培训!可边学习边在线修改示例代码,查看执行效果!php从入门到精通,一站式php自学平台!&quot;&gt;</pre><p>定义页面的描述信息有利于搜索引擎的搜索。</p> <blockquote> <p></p> <title> 标签定义文档标题,name="description" 定义文档描述,描述的长度通常大于标题。</title> </blockquote> <p>3) 定义关键字</p><pre class='brush:php;toolbar:false;'>&lt;meta name=&quot;keywords&quot; content=&quot;php教程,php入门教程,php视频教程,php源码下载,php手册&quot;&gt;</pre><p>关键字用于为搜索引擎提供与页面有关的信息。</p> <p>4) 定义页面作者</p><pre class='brush:php;toolbar:false;'>&lt;meta name=&quot;author&quot; content=&quot;PHP中文网&quot;&gt;</pre><p>通过某些内容管理系统可以自动提取作者信息。</p> <p>5) 刷新页面</p><pre class='brush:php;toolbar:false;'>&lt;meta http-equiv=&quot;refresh&quot; content=&quot;30&quot;&gt;</pre><p>上例中的代码用于向浏览器发送一个指令,使浏览器在经过指定的时间间隔(30 秒)后自动刷新页面。在 content 属性中除了可以指定时间间隔外,还可以再指定一个链接,这时页面将在指定的时间后重定向到链接所指向的页面,如下例所示:</p><pre class='brush:php;toolbar:false;'>&lt;meta http-equiv=&quot;refresh&quot; content=&quot;10; url=https://www.php.cn/&quot;&gt;</pre><p><strong>7、<script> 标签</script></strong></p> <p><script> 标签用于定义 JavaScript 脚本,示例代码如下:</script></p><pre class='brush:php;toolbar:false;'><head> <title>PHP中文网</title> <script> document.write("PHP中文网") </script> </head></pre><p><strong>8、<noscript> 标签</noscript></strong></p> <p>当用户的浏览器不支持 JavaScript 脚本或者禁用 JavaScript 脚本时,可以在 <noscript> 标签中定义一些内容来替代不能运行的 JavaScript 脚本或者给用户一些提示。除了 <script> 标签外,在 <noscript> 标签中可以包含任何 HTML 元素,如下例所示:</script> </noscript></p><pre class='brush:php;toolbar:false;'><head> <title>PHP中文网</title> <noscript> <p>您的浏览器不支持 JavaScript 或者您禁用了 JavaScript,请<a href="https://www.php.cn/">点击这里</a>了解如何启用 JavaScript。</p> </noscript> </head></pre><p>相关推荐:《<a href="http://www.php.cn/course/list/11.html" target="_blank" textvalue="html视频教程">html视频教程</a>》</p> </li>

The above is the detailed content of What are the head tags of html5. For more information, please follow other related articles on the PHP Chinese website!

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Related Article
React: The Foundation for Modern Frontend DevelopmentReact: The Foundation for Modern Frontend DevelopmentApr 19, 2025 am 12:23 AM

React is a JavaScript library for building modern front-end applications. 1. It uses componentized and virtual DOM to optimize performance. 2. Components use JSX to define, state and attributes to manage data. 3. Hooks simplify life cycle management. 4. Use ContextAPI to manage global status. 5. Common errors require debugging status updates and life cycles. 6. Optimization techniques include Memoization, code splitting and virtual scrolling.

The Future of React: Trends and Innovations in Web DevelopmentThe Future of React: Trends and Innovations in Web DevelopmentApr 19, 2025 am 12:22 AM

React's future will focus on the ultimate in component development, performance optimization and deep integration with other technology stacks. 1) React will further simplify the creation and management of components and promote the ultimate in component development. 2) Performance optimization will become the focus, especially in large applications. 3) React will be deeply integrated with technologies such as GraphQL and TypeScript to improve the development experience.

React: A Powerful Tool for Building UI ComponentsReact: A Powerful Tool for Building UI ComponentsApr 19, 2025 am 12:22 AM

React is a JavaScript library for building user interfaces. Its core idea is to build UI through componentization. 1. Components are the basic unit of React, encapsulating UI logic and styles. 2. Virtual DOM and state management are the key to component work, and state is updated through setState. 3. The life cycle includes three stages: mount, update and uninstall. The performance can be optimized using reasonably. 4. Use useState and ContextAPI to manage state, improve component reusability and global state management. 5. Common errors include improper status updates and performance issues, which can be debugged through ReactDevTools. 6. Performance optimization suggestions include using memo, avoiding unnecessary re-rendering, and using us

Using React with HTML: Rendering Components and DataUsing React with HTML: Rendering Components and DataApr 19, 2025 am 12:19 AM

Using HTML to render components and data in React can be achieved through the following steps: Using JSX syntax: React uses JSX syntax to embed HTML structures into JavaScript code, and operates the DOM after compilation. Components are combined with HTML: React components pass data through props and dynamically generate HTML content, such as. Data flow management: React's data flow is one-way, passed from the parent component to the child component, ensuring that the data flow is controllable, such as App components passing name to Greeting. Basic usage example: Use map function to render a list, you need to add a key attribute, such as rendering a fruit list. Advanced usage example: Use the useState hook to manage state and implement dynamics

React's Purpose: Building Single-Page Applications (SPAs)React's Purpose: Building Single-Page Applications (SPAs)Apr 19, 2025 am 12:06 AM

React is the preferred tool for building single-page applications (SPAs) because it provides efficient and flexible ways to build user interfaces. 1) Component development: Split complex UI into independent and reusable parts to improve maintainability and reusability. 2) Virtual DOM: Optimize rendering performance by comparing the differences between virtual DOM and actual DOM. 3) State management: manage data flow through state and attributes to ensure data consistency and predictability.

React: The Power of a JavaScript Library for Web DevelopmentReact: The Power of a JavaScript Library for Web DevelopmentApr 18, 2025 am 12:25 AM

React is a JavaScript library developed by Meta for building user interfaces, with its core being component development and virtual DOM technology. 1. Component and state management: React manages state through components (functions or classes) and Hooks (such as useState), improving code reusability and maintenance. 2. Virtual DOM and performance optimization: Through virtual DOM, React efficiently updates the real DOM to improve performance. 3. Life cycle and Hooks: Hooks (such as useEffect) allow function components to manage life cycles and perform side-effect operations. 4. Usage example: From basic HelloWorld components to advanced global state management (useContext and

React's Ecosystem: Libraries, Tools, and Best PracticesReact's Ecosystem: Libraries, Tools, and Best PracticesApr 18, 2025 am 12:23 AM

The React ecosystem includes state management libraries (such as Redux), routing libraries (such as ReactRouter), UI component libraries (such as Material-UI), testing tools (such as Jest), and building tools (such as Webpack). These tools work together to help developers develop and maintain applications efficiently, improve code quality and development efficiency.

React and Frontend Development: A Comprehensive OverviewReact and Frontend Development: A Comprehensive OverviewApr 18, 2025 am 12:23 AM

React is a JavaScript library developed by Facebook for building user interfaces. 1. It adopts componentized and virtual DOM technology to improve the efficiency and performance of UI development. 2. The core concepts of React include componentization, state management (such as useState and useEffect) and the working principle of virtual DOM. 3. In practical applications, React supports from basic component rendering to advanced asynchronous data processing. 4. Common errors such as forgetting to add key attributes or incorrect status updates can be debugged through ReactDevTools and logs. 5. Performance optimization and best practices include using React.memo, code segmentation and keeping code readable and maintaining dependability

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

MinGW - Minimalist GNU for Windows

MinGW - Minimalist GNU for Windows

This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools

Safe Exam Browser

Safe Exam Browser

Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment