search
HomeWeb Front-endHTML TutorialSummary of html meta, introduction to the use of meta attributes in html tags

Quote: http://www.haorooms.com/post/html_meta_ds

Foreword

meta is an auxiliary tag in the head area of ​​html language. Maybe you think this code is dispensable. In fact, if you can make good use of meta tags, it will bring you unexpected effects. The functions of meta tags are: search engine optimization (SEO), defining the language used on the page, automatically refreshing and pointing to new pages, and realizing dynamics during web page conversion. Effect, control page buffering, web page rating and evaluation, control the window for web page display, etc.!

html meta summary

Composition of the meta tag: The meta tag has two attributes, which are the http-equiv attribute and the name attribute. Different attributes have different parameter values. These different parameter values ​​realize different web page functions.

1. name attribute

The name attribute is mainly used to describe web pages, and the corresponding attribute value is content. The content in content is mainly used by search engine robots to find information and classify information.

The syntax format of the name attribute of the

meta tag is:

<code><span class="tag"><meta<span class="pln"> <span class="atn">name<span class="pun">=<span class="atv">"参数"<span class="atn">content<span class="pun">=<span class="atv">"具体的参数值"<span class="tag">><span class="pln">。 </span></span></span></span></span></span></span></span></span></span></code>

The name attribute mainly has the following parameters:

A、Keywords 

Explanation: keywords are used to tell search engines what the keywords of your web page are.

Example:

<code><span class="tag"><meta<span class="pln"> <span class="atn">name<span class="pun">=<span class="atv">"keywords"<span class="atn">content<span class="pun">=<span class="atv">"meta总结,html meta,meta属性,meta跳转"<span class="tag">></span></span></span></span></span></span></span></span></span></code>

B、description(website content description)

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

Example:

<code><span class="tag"><meta<span class="pln"> <span class="atn">name<span class="pun">=<span class="atv">"description"<span class="atn">content<span class="pun">=<span class="atv">"haorooms博客,html的meta总结,meta是html语言head区的一个辅助性标签。"<span class="tag">></span></span></span></span></span></span></span></span></span></code>

C, robots (robot guide)

Description: Robots are used to tell search robots which pages need to be indexed and which pages do not need to be indexed.

The parameters of content include all, none, index, noindex, follow, and nofollow. The default is all.

Example:

<code><span class="tag"><meta<span class="pln"> <span class="atn">name<span class="pun">=<span class="atv">"robots"<span class="atn">content<span class="pun">=<span class="atv">"none"<span class="tag">></span></span></span></span></span></span></span></span></span></code>

The specific parameters are as follows:

The information parameter is all: the file will be retrieved and the links on the page can be queried;

The information parameter is none: the file will not be retrieved, and the links on the page cannot be queried;

The information parameter is index: the file will be retrieved;

The information parameter is follow: links on the page can be queried;

The information parameter is noindex: the file will not be retrieved, but the links on the page can be queried;

The information parameter is nofollow: the file will be retrieved, but the links on the page cannot be queried;

D、author(author)

Instructions: Mark the author of the webpage

Example:

<code><span class="tag"><meta<span class="pln"> <span class="atn">name<span class="pun">=<span class="atv">"author"<span class="atn">content<span class="pun">=<span class="atv">"root,root@xxxx.com"<span class="tag">></span></span></span></span></span></span></span></span></span></code>

E、generator

<code><span class="tag"><meta<span class="pln"> <span class="atn">name<span class="pun">=<span class="atv">"generator"<span class="atn">content<span class="pun">=<span class="atv">"信息参数"<span class="tag">/></span></span></span></span></span></span></span></span></span></code>

The generator information parameter of the meta tag represents the software used to create the website.

F、COPYRIGHT

<code><span class="tag"><META<span class="pln"> <span class="atn">NAME<span class="pun">=<span class="atv">"COPYRIGHT"<span class="atn">CONTENT<span class="pun">=<span class="atv">"信息参数"<span class="tag">></span></span></span></span></span></span></span></span></span></code>

The COPYRIGHT information parameter of the meta tag represents website copyright information.

G、revisit-after

<code><span class="tag"><META<span class="pln"> <span class="atn">name<span class="pun">=<span class="atv">"revisit-after"<span class="atn">CONTENT<span class="pun">=<span class="atv">"7days"<span class="tag">></span></span></span></span></span></span></span></span></span></code>

revisit-after represents website revisit, 7days represents 7 days, and so on.

2. http-equiv attribute

http-equiv, as the name suggests, is equivalent to the file header function of http. It can return some useful information to the browser to help display web page content correctly and accurately. The corresponding attribute value is content, and the content in content is actually It is the variable value of each parameter.

The http-equiv attribute syntax format of

meta tag is:

<code><span class="tag"><meta<span class="pln"> <span class="atn">http-equiv<span class="pun">=<span class="atv">"参数"<span class="atn">content<span class="pun">=<span class="atv">"参数变量值"<span class="tag">><span class="pln">; </span></span></span></span></span></span></span></span></span></span></code>

The http-equiv attribute mainly has the following parameters:

A、Expires

Description: Can be used to set the expiration time of the web page. Once a web page expires, it must be retransmitted to the server.

Usage:

<code><span class="tag"><meta<span class="pln"> <span class="atn">http-equiv<span class="pun">=<span class="atv">"expires"<span class="atn">content<span class="pun">=<span class="atv">"Fri,12Jan200118:18:18GMT"<span class="tag">></span></span></span></span></span></span></span></span></span></code>

Note: GMT time format must be used.

B, Pragma (cache mode)

Description: Disable the browser from accessing page content from the local computer's cache.

Usage:

<code><span class="tag"><meta<span class="pln"> <span class="atn">http-equiv<span class="pun">=<span class="atv">"Pragma"<span class="atn">content<span class="pun">=<span class="atv">"no-cache"<span class="tag">></span></span></span></span></span></span></span></span></span></code>

Note: With this setting, visitors will not be able to browse offline.

C、Refresh

Description: Automatically refresh and point to new page.

Usage:

<code><span class="tag"><meta<span class="pln"> <span class="atn">http-equiv<span class="pun">=<span class="atv">"Refresh"<span class="atn">content<span class="pun">=<span class="atv">"2;URL=http://www.haorooms.com"<span class="tag">><span class="pln"> //(注意后面的引号,分别在秒数的前面和网址的后面) </span></span></span></span></span></span></span></span></span></span></code>

Note: The 2 refers to automatically refreshing to the URL after staying for 2 seconds.

D、Set-Cookie(cookie setting)

Note: If the web page expires, the saved cookies will be deleted.

Usage:

<code><span class="tag"><meta<span class="pln"> <span class="atn">http-equiv<span class="pun">=<span class="atv">"Set-Cookie"<span class="atn">content<span class="pun">=<span class="atv">"cookie value=xxx;expires=Friday,12-Jan-200118:18:18GMT;path=/"<span class="tag">></span></span></span></span></span></span></span></span></span></code>

Note: GMT time format must be used.

E, Window-target (display window setting)

Description: Force the page to be displayed as an independent page in the current window.

Usage:

<code><span class="tag"><meta<span class="pln"> <span class="atn">http-equiv<span class="pun">=<span class="atv">"Window-target"<span class="atn">content<span class="pun">=<span class="atv">"_top"<span class="tag">></span></span></span></span></span></span></span></span></span></code>

Note: Used to prevent others from calling your own page in the frame.

F, content-Type (display character set setting)

Description: Set the character set used by the page.

Usage:

<code><span class="tag"><meta<span class="pln"> <span class="atn">http-equiv<span class="pun">=<span class="atv">"content-Type"<span class="atn">content<span class="pun">=<span class="atv">"text/html;charset=gb2312"<span class="tag">></span></span></span></span></span></span></span></span></span></code>

The details are as follows:

When the charset information parameter of the meta tag is such as GB2312, it means that the encoding used by the website is Simplified Chinese;

When the charset information parameter of the meta tag is such as BIG5, it means that the encoding used by the website is Traditional Chinese;

When the charset information parameter of the meta tag is such as iso-2022-jp, it means that the encoding used by the website is Japanese;

When the charset information parameter of the meta tag is such as ks_c_5601, it means that the encoding used by the website is Korean;

When the charset information parameter of the meta tag is such as ISO-8859-1, it means that the encoding used by the website is English;

When the charset information parameter of the meta tag is such as UTF-8, it represents the world's universal language encoding;

G、content-Language(显示语言的设定)

用法:

<code><span class="tag"><meta<span class="pln"> <span class="atn">http-equiv<span class="pun">=<span class="atv">"Content-Language"<span class="atn">content<span class="pun">=<span class="atv">"zh-cn"<span class="tag">/></span></span></span></span></span></span></span></span></span></code>

H、Cache-Control指定请求和响应遵循的缓存机制。

Cache-Control指定请求和响应遵循的缓存机制。在请求消息或响应消息中设置Cache-Control并不会修改另一个消息处理过程中的缓存处理过程。请求时的缓存指令包括no-cache、no-store、max-age、max-stale、min-fresh、on

ly-if-cached,响应消息中的指令包括public、private、no-cache、no-store、no-transform、must-revalidate、proxy-revalidate、max-age。各个消息中的指令含义如下

Public指示响应可被任何缓存区缓存

Private指示对于单个用户的整个或部分响应消息,不能被共享缓存处理。这允许服务器仅仅描述当用户的部分响应消息,此响应消息对于其他用户的请求无效

no-cache指示请求或响应消息不能缓存

no-store用于防止重要的信息被无意的发布。在请求消息中发送将使得请求和响应消息都不使用缓存。

max-age指示客户机可以接收生存期不大于指定时间(以秒为单位)的响应

min-fresh指示客户机可以接收响应时间小于当前时间加上指定时间的响应

max-stale指示客户机可以接收超出超时期间的响应消息。如果指定max-stale消息的值,那么客户机可以接收超出超时期指定值之内的响应消息。

J、http-equiv="imagetoolbar"

<code><span class="tag"><meta<span class="pln"> <span class="atn">http-equiv<span class="pun">=<span class="atv">"imagetoolbar"<span class="atn">content<span class="pun">=<span class="atv">"false"<span class="tag">/></span></span></span></span></span></span></span></span></span></code>

指定是否显示图片工具栏,当为false代表不显示,当为true代表显示。

K、Content-Script-Type

<code><span class="tag"><Meta<span class="pln"> <span class="atn">http-equiv<span class="pun">=<span class="atv">"Content-Script-Type"<span class="atn">Content<span class="pun">=<span class="atv">"text/javascript"<span class="tag">></span></span></span></span></span></span></span></span></span></code>

W3C网页规范,指明页面中脚本的类型。

L 页面跳转,只用于IE

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
The Future of HTML: Evolution and TrendsThe Future of HTML: Evolution and TrendsMay 13, 2025 am 12:01 AM

The future of HTML will develop in a more semantic, functional and modular direction. 1) Semanticization will make the tag describe the content more clearly, improving SEO and barrier-free access. 2) Functionalization will introduce new elements and attributes to meet user needs. 3) Modularity will support component development and improve code reusability.

Why are HTML attributes important for web development?Why are HTML attributes important for web development?May 12, 2025 am 12:01 AM

HTMLattributesarecrucialinwebdevelopmentforcontrollingbehavior,appearance,andfunctionality.Theyenhanceinteractivity,accessibility,andSEO.Forexample,thesrcattributeintagsimpactsSEO,whileonclickintagsaddsinteractivity.Touseattributeseffectively:1)Usese

What is the purpose of the alt attribute? Why is it important?What is the purpose of the alt attribute? Why is it important?May 11, 2025 am 12:01 AM

The alt attribute is an important part of the tag in HTML and is used to provide alternative text for images. 1. When the image cannot be loaded, the text in the alt attribute will be displayed to improve the user experience. 2. Screen readers use the alt attribute to help visually impaired users understand the content of the picture. 3. Search engines index text in the alt attribute to improve the SEO ranking of web pages.

HTML, CSS, and JavaScript: Examples and Practical ApplicationsHTML, CSS, and JavaScript: Examples and Practical ApplicationsMay 09, 2025 am 12:01 AM

The roles of HTML, CSS and JavaScript in web development are: 1. HTML is used to build web page structure; 2. CSS is used to beautify the appearance of web pages; 3. JavaScript is used to achieve dynamic interaction. Through tags, styles and scripts, these three together build the core functions of modern web pages.

How do you set the lang attribute on the  tag? Why is this important?How do you set the lang attribute on the tag? Why is this important?May 08, 2025 am 12:03 AM

Setting the lang attributes of a tag is a key step in optimizing web accessibility and SEO. 1) Set the lang attribute in the tag, such as. 2) In multilingual content, set lang attributes for different language parts, such as. 3) Use language codes that comply with ISO639-1 standards, such as "en", "fr", "zh", etc. Correctly setting the lang attribute can improve the accessibility of web pages and search engine rankings.

What is the purpose of HTML attributes?What is the purpose of HTML attributes?May 07, 2025 am 12:01 AM

HTMLattributesareessentialforenhancingwebelements'functionalityandappearance.Theyaddinformationtodefinebehavior,appearance,andinteraction,makingwebsitesinteractive,responsive,andvisuallyappealing.Attributeslikesrc,href,class,type,anddisabledtransform

How do you create a list in HTML?How do you create a list in HTML?May 06, 2025 am 12:01 AM

TocreatealistinHTML,useforunorderedlistsandfororderedlists:1)Forunorderedlists,wrapitemsinanduseforeachitem,renderingasabulletedlist.2)Fororderedlists,useandfornumberedlists,customizablewiththetypeattributefordifferentnumberingstyles.

HTML in Action: Examples of Website StructureHTML in Action: Examples of Website StructureMay 05, 2025 am 12:03 AM

HTML is used to build websites with clear structure. 1) Use tags such as, and define the website structure. 2) Examples show the structure of blogs and e-commerce websites. 3) Avoid common mistakes such as incorrect label nesting. 4) Optimize performance by reducing HTTP requests and using semantic tags.

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 Article

Hot Tools

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

EditPlus Chinese cracked version

EditPlus Chinese cracked version

Small size, syntax highlighting, does not support code prompt function

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.

SecLists

SecLists

SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.