What are the three elements of meta tags in html5? Summary of the use of meta tags

寻∝梦
Release: 2018-08-30 15:05:01
Original
14863 people have browsed it

This article mainly tells you about the three elements of the html meta tag, which is an introduction to the composition and use of the three attributes. There are many important attribute values in it, which are very useful in web pages. Now Let’s read this article together

First of all, we need to know what are the three elements of meta tags?

1. Required attribute: content attribute. This attribute is used to define meta-information related to the http-equiv or name attribute. The content is used to facilitate search robots to find information and classify it.

2. Optional attributes: name attribute This attribute is mainly used to describe web pages. The value of the Name attribute can be: author, description, keyword, generator, etc.

3. Optional attribute: http-equiv attribute. This attribute is equivalent to the HTTP header file and can return some useful information to the browser to help display the content correctly and accurately. The value of the http-equiv attribute can include content-type, expires, refresh, etc.;

These three attributes make up the three elements of the html5 meta tag.

Now let’s take a look at the specific use of these attributes:

But when you open any website, there will be a column of meta tags in the head tag.

meta is often used to define page descriptions, keywords, last modified date, and other metadata. This metadata will serve browsers (how the page is laid out or reloaded), search engines and other web services.

The meta tag has two attributes, namely the http-equiv attribute and the name attribute.

The name attribute of the HTML5 meta tag:

The main name attribute Used to describe web pages, such as keywords, narratives, etc. The corresponding attribute value is content. The content in content is a specific description of the name input type, which is convenient for search engines to crawl. The syntax format of the name attribute in the meta tag is:

Copy after login

The name attribute is the most important parameter.

The value of the name attribute of the HTML5 meta tag keywords (keywords):

Description: Used to tell search engines the keywords of your web page. Example:

Copy after login

The value of the name attribute of the HTML5 meta tag description (description of website content):

Description: used to tell search engines the main content of your website . Example:

Copy after login

The value of the name attribute of the HTML5 meta tag author (author):

is used to mark the author of the web page. Example:

Copy after login

## The http-equiv attribute of the #HTML5 meta tag:

http-equiv, as the name suggests, is equivalent to the file header function of http.

Equivalent to the role of HTTP, such as defining some HTTP parameters and so on.

The http-equiv attribute syntax format in the meta tag is:

Copy after login

The http-equiv attribute talks about one of the parameters:

content-Type (setting the webpage character set) (recommended to use HTML5 method)

Description: used to set the webpage character set to facilitate browser parsing and rendering of the page. Example:

//Old HTML, not recommended

//HTML5's way of setting the character set of web pages, it is recommended to use UTF-8

That's all for summary, there are too many custom attributes of meta tags. So I only looked for some commonly used ones, and properties that have been basically abandoned like Window-target, and I didn’t add them.

The role of the HTML5 meta tag:

The META tag is a key tag in the HEAD area of the HTML tag, providing basic information such as document character set, language, author, etc., and The biggest role of setting keywords and web page levels is to do search engine optimization (SEO).


【Editor’s Recommendation】

html Is the p tag a single tag? Introduction to the use of html p tags (with examples included)

How to create a multi-line text input box in the input form? An article teaches you how to use input tags

The above is the detailed content of What are the three elements of meta tags in html5? Summary of the use of meta tags. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
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
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!