The head elements of the html document include: element, element, element, element, <link> element, <script> element and <base> ;element. <br/><p>The header of the document describes various attributes and information of the document, including the title of the document, its location in the Web, and its relationship with other documents; the header element is used to define these information. This article will introduce you to the head elements of html documents so that you can understand the role of the head elements of html documents. I hope it will be helpful to you. [Video tutorial recommendation: <a href="http://www.php.cn/course/list/11.html" target="_blank">HTML tutorial]<p style="text-align: center;"><img src="https://img.php.cn/upload/article/000/000/024/5c18b67545a8c13What are the head elements of html documents"/ alt="What are the head elements of html documents" ><p><span style="max-width:90%">##html <head> element<strong> The <head> element is used to define the head of the document and is a container for all other head elements. Various attributes and information of the HTML document are defined in the <head> element. <p>Let's take a look at a simple html document, which has the most basic required elements: <p><div class="code" style="position:relative; padding:0px; margin:0px;"><pre class="brush:html;toolbar:false"><!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>标题</title> </head> <body> </body> </html></pre><div class="contentsignin">Copy after login</div></div></p>As can be seen, the <head> element is located in the <html> tag and < Between the body> tags, include other head elements. <p></p><p><span style="font-size: 18px;">html <meta> element <strong></strong></span></p><meta> element is used to specify the character set, page description, and keywords on the web page , author and other metadata. <p></p> Among them, metadata is mainly provided to browsers, search engines and other web services to better rank web pages. <p></p> Let’s take a look at how to use the <meta> element: <p><div class="code" style="position:relative; padding:0px; margin:0px;"><pre class="brush:html;toolbar:false;">//定义字符集 <meta charset = "UTF-8" > //为搜索引擎定义关键字 <meta name = "keywords" content = "php教程,php入门教程,php视频教程,php源码下载,php手册" > //定义网页的说明 <meta name = "description" content = "php中文网提供大量免费、原创、高清的php视频教程,并定期举行公益php培训!" > //定义网页的作者 <meta name = "author" content = "php中文网" > //定义每30秒刷新一次文档: <meta http-equiv = "refresh" content = "30" > //控制视口(HTML5提供的新属性) <meta name = "viewport" content = "width = device-width,initial-scale = 1.0" ></pre><div class="contentsignin">Copy after login</div></div></p> Description: The viewport is the user’s visible area on the web page. It varies between devices and looks smaller on a phone than on a computer screen. <p></p><p><span style="font-size: 18px;">html <title> element <strong></strong></span></p><title> element is used to define the title of the document; applicable to all HTML or XHTML documents . <p></p><title>The role of the element:<p></p>1. The title can be defined in the browser tab. <p></p>2. You can provide a title for the page when adding it to favorites. <p></p>3. The title of the page can be displayed in search engine results. <p></p>Example:<p><div class="code" style="position:relative; padding:0px; margin:0px;"><pre class="brush:html;toolbar:false"><!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>php中文网</title> </head> <body> <p>正文的内容显示在浏览器窗口中。</p> <p>title元素的内容显示在浏览器标签,收藏夹和搜索引擎结果中。</p> </body> </html></pre><div class="contentsignin">Copy after login</div></div></p>Rendering:<p></p><p style="text-align: center;"><img src="https://img.php.cn/upload/article/000/000/024/5c18b92ec6088231.jpg"/ alt="What are the head elements of html documents" ></p><p>##html <style>Element<strong><span style="max-width:90%"></span></strong>The<style> element is used to set the style of the HTML page. The inline css style code is written within the <style> element. Example: </p><div class="code" style="position:relative; padding:0px; margin:0px;"><pre class="brush:css;toolbar:false"><style> body {background-color:pink;} h1 {color:red;} p {color:blue;} 这是一个标题 这是一个段落。Copy after loginRendering: ##HTML Element## The # element is used to link external css style sheets to web pages. The basic syntax is: Copy after login Example: Copy after loginHTML element </p><p><strong><span style="font-size: 18px;"><script> element is Used to define client-side scripts, such as JavaScript. </span></strong>We can include script statements in the <script> element, for example: </p><div class="code" style="position:relative; padding:0px; margin:0px;"><pre class="brush:js;toolbar:false"><script> console.log("<script> 元素"); Copy after loginOutput: Also through the src attribute Link external script files to the web page, for example: Copy after loginHTML element element is used to specify the page The base URL and base target for all relative URLs in . Example: Copy after login Summary: The above is the entire content of this article, I hope it will be helpful to everyone's study.