Home >Web Front-end >HTML Tutorial >What is the head tag? Introduction to head tag in html

What is the head tag? Introduction to head tag in html

不言
不言Original
2018-08-13 17:50:004272browse

The content of this article is about what is the head tag? The introduction of the head tag in HTML has certain reference value. Friends in need can refer to it. I hope it will be helpful to you.

What is the head tag

The head tag is the content of the element. Unlike the content of the element, which can be displayed in the browser, the content of the head will not be displayed in the browser. Its function is to contain some metadata of the page. In the example below, head has very little content.

<head>
  <meta charset="utf-8">
  <title>My test page</title>
</head>
  • Metadata is the data that describes the data.

title

The element is used to represent the entire Metadata about the approximate content of an HTML document (not the content of the document.) The <br> element <title> is also used in other ways. For example, if you try to bookmark a page, (Bookmarks > Bookmark This Page, in Firefox), you will see the content of <title> as a suggested bookmark.</p> <h2>Metadata<meta></h2> <p>Metadata describes the data data, and HTML has an "official" way to add metadata to a document - the <meta> element. Of course, the other things mentioned in this article can also be considered metadata. There are many different kinds of <meta> elements that can be included in the <head> element of your page, but we won't try to explain all of them just yet, as that would just cause confusion. </p> <pre class="brush:php;toolbar:false"><meta charset="utf-8"></pre> <ul class=" list-paddingleft-2"><li><p>This element simply specifies the document's character encoding - the character set that is allowed to be used in this document. utf-8<br> is a universal character set that contains most characters in any human language. This means that your web pages can be displayed in any language; many <meta><br> elements contain name and content attributes. The </p></li></ul> <p>name attribute specifies the type of meta element; Describes what type of information this element contains. <br>content specifies the actual metadata content. <br>These two meta elements are useful for defining the author of your page and providing a description of the page's content. </p> <pre class="brush:php;toolbar:false"><meta name="author" content="Chris Mills"> <meta name="description" content="The MDN Learning Area aims to provide complete beginners to the Web with all they need to know to get started with developing web sites and applications."></pre> <ul class=" list-paddingleft-2"><li><p>Specifying the author can be useful in certain situations: if you need to contact the author of a page to ask questions about the page's content. <br> Some content management systems can automatically obtain the page author's information and then use it for certain purposes. <br> It is useful to specify a description of the page content that contains keywords about the page content, because it may or may not make your page appear more in relevant searches in search engines (these actions are termed <br> Search Engine Optimization, or SEO.)</p></li></ul> <h2>Add custom icons to your site</h2> <pre class="brush:php;toolbar:false"><link rel="shortcut icon" href="favicon.ico" type="image/x-icon"></pre> <h2>Apply CSS and JavaScript to HTML</h2> <pre class="brush:php;toolbar:false"><link rel="stylesheet" href="my-css-file.css"></pre> <ul class=" list-paddingleft-2"> The <li><p><link> element is often located at the head of the document. It has two attributes, rel="stylesheet", indicating that this is the style sheet of the document, and <br> href, which contains the style sheet file. path. The </p></li> </ul> <pre class="brush:php;toolbar:false"><script src="my-js-file.js"></script></pre> <ul class=" list-paddingleft-2"><li> <p><script> section does not have to be at the top of the document; in fact, place it at the end of the document (in </body> ; before the tag) is a better choice <br/>, which ensures that the browser has parsed the HTML content before loading the script (if the script loads a non-existent element, the browser will report an error). </p></li></ul><h2>Set the main language for the document</h2><pre class="brush:php;toolbar:false"><html lang="en-US"></p> <ul class=" list-paddingleft-2"><li><p>This is useful in many ways. Your HTML document will be indexed <br> more efficiently by search engines if the language of your HTML document is set properly (e.g., allowing it to display correctly in language-specific results), for those using screen readers It is also useful for visually impaired people (for example, <br> There is a word "six" in both French and English, but the pronunciation is completely different). </p></li></ul> <p class="post-topheader custom- pt0">Related recommendations: </p> <p class="post-topheader custom- pt0"><a href="http://www.php.cn/html5-tutorial-407893.html" target="_blank" title="Html5中video标签的用法:如何自动填充满父div标签">Usage of video tag in Html5: How to automatically fill in parent div tag</a></p> <p class="post-topheader custom- pt0"><a href="http://www.php.cn/div-tutorial-408203.html" target="_blank" title="html提交按钮标签代码是什么,怎么使用?(示例)"> What is the html submit button label code and how to use it? (Example) How to add friendly links in the </a></p> <p class="post-topheader custom- pt0"><a href="http://www.php.cn/div-tutorial-408104.html" target="_blank" title="html页面中友情链接怎么进行添加设置?(代码示例)">#html page? (code example)</a></p> </li></ul><p>The above is the detailed content of What is the head tag? Introduction to head tag in html. For more information, please follow other related articles on the PHP Chinese website!</p></div><div class="nphpQianMsg"><div class="clear"></div></div><div class="nphpQianSheng"><span>Statement:</span><div>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</div></div></div><div class="nphpSytBox"><span>Previous article:<a class="dBlack" title="What is the html submit button label code and how to use it? (example)" href="https://m.php.cn/faq/408203.html">What is the html submit button label code and how to use it? (example)</a></span><span>Next article:<a class="dBlack" title="What is the html submit button label code and how to use it? (example)" href="https://m.php.cn/faq/408215.html">What is the html submit button label code and how to use it? (example)</a></span></div><div class="nphpSytBox2"><div class="nphpZbktTitle"><h2>Related articles</h2><em><a href="https://m.php.cn/article.html" class="bBlack"><i>See more</i><b></b></a></em><div class="clear"></div></div><ins class="adsbygoogle" style="display:block" data-ad-format="fluid" data-ad-layout-key="-6t+ed+2i-1n-4w" data-ad-client="ca-pub-5902227090019525" data-ad-slot="8966999616"></ins><script> (adsbygoogle = window.adsbygoogle || []).push({}); </script><ul class="nphpXgwzList"><li><b></b><a href="https://m.php.cn/faq/348757.html" title="Summary of Html knowledge" class="aBlack">Summary of Html knowledge</a><div class="clear"></div></li><li><b></b><a href="https://m.php.cn/faq/348804.html" title="How to learn HTML quickly" class="aBlack">How to learn HTML quickly</a><div class="clear"></div></li><li><b></b><a href="https://m.php.cn/faq/348873.html" title="The difference between html xhtml xml" class="aBlack">The difference between html xhtml xml</a><div class="clear"></div></li><li><b></b><a href="https://m.php.cn/faq/348884.html" title="The difference between src and href attributes" class="aBlack">The difference between src and href attributes</a><div class="clear"></div></li><li><b></b><a href="https://m.php.cn/faq/348902.html" title="About HTML5 and CSS replacement use" class="aBlack">About HTML5 and CSS replacement use</a><div class="clear"></div></li></ul></div></div><ins class="adsbygoogle" style="display:block" data-ad-format="autorelaxed" data-ad-client="ca-pub-5902227090019525" data-ad-slot="5027754603"></ins><script> (adsbygoogle = window.adsbygoogle || []).push({}); </script><footer><div class="footer"><div class="footertop"><img src="/static/imghwm/logo.png" alt=""><p>Public welfare online PHP training,Help PHP learners grow quickly!</p></div><div class="footermid"><a href="https://m.php.cn/about/us.html">About us</a><a href="https://m.php.cn/about/disclaimer.html">Disclaimer</a><a href="https://m.php.cn/update/article_0_1.html">Sitemap</a></div><div class="footerbottom"><p> © php.cn All rights reserved </p></div></div></footer><script>isLogin = 0;</script><script type="text/javascript" src="/static/layui/layui.js"></script><script type="text/javascript" src="/static/js/global.js?4.9.47"></script></div><script src="https://vdse.bdstatic.com//search-video.v1.min.js"></script><link rel='stylesheet' id='_main-css' href='/static/css/viewer.min.css' type='text/css' media='all'/><script type='text/javascript' src='/static/js/viewer.min.js?1'></script><script type='text/javascript' src='/static/js/jquery-viewer.min.js'></script><script>jQuery.fn.wait = function (func, times, interval) { var _times = times || -1, //100次 _interval = interval || 20, //20毫秒每次 _self = this, _selector = this.selector, //选择器 _iIntervalID; //定时器id if( this.length ){ //如果已经获取到了,就直接执行函数 func && func.call(this); } else { _iIntervalID = setInterval(function() { if(!_times) { //是0就退出 clearInterval(_iIntervalID); } _times <= 0 || _times--; //如果是正数就 -- _self = $(_selector); //再次选择 if( _self.length ) { //判断是否取到 func && func.call(_self); clearInterval(_iIntervalID); } }, _interval); } return this; } $("table.syntaxhighlighter").wait(function() { $('table.syntaxhighlighter').append("<p class='cnblogs_code_footer'><span class='cnblogs_code_footer_icon'></span></p>"); }); $(document).on("click", ".cnblogs_code_footer",function(){ $(this).parents('table.syntaxhighlighter').css('display','inline-table');$(this).hide(); }); $('.nphpQianCont').viewer({navbar:true,title:false,toolbar:false,movable:false,viewed:function(){$('img').click(function(){$('.viewer-close').trigger('click');});}}); </script></body><!-- Matomo --><script> var _paq = window._paq = window._paq || []; /* tracker methods like "setCustomDimension" should be called before "trackPageView" */ _paq.push(['trackPageView']); _paq.push(['enableLinkTracking']); (function() { var u="https://tongji.php.cn/"; _paq.push(['setTrackerUrl', u+'matomo.php']); _paq.push(['setSiteId', '9']); var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0]; g.async=true; g.src=u+'matomo.js'; s.parentNode.insertBefore(g,s); })(); </script><!-- End Matomo Code --></html>