Summary of HTML meta tag usage
meta tags are very important in HTML. In this article we will introduce a summary of the usage of HTML meta tags, hoping to help everyone.
What is mata tag
element can provide meta-information about the page, such as search engine and update frequency Degree description and keywords. The
tag is located at the head of the document and does not contain any content. The tag's properties define the name/value pairs associated with the document.
meta is an auxiliary tag in the head area of html language. We can see meta tags in almost all web pages, but they cannot be seen in the browser's display page. Maybe you think these codes are dispensable. In fact, the meta tag is very important and will bring practical effects to your website. For example, the website description () will be reflected in the search engine index. For example, use the meta tag to set the encoding of the website to gbk2312 or utf-8. The meta tag setting key Words
Basic Grammar
<meta name="keywords" content="关键字1,关键字2,关键字3....">
The function of keyword tags is to tell search engines what aspects of the content of the website are about, making it easier for search engines to define and index the website. .Keywords are separated by commas under the English input method. The length of keywords generally does not exceed 100 characters.
For example, our website is about learning web development technology, and the keyword description can be written like this :
<meta name="keywords" content="html教程,css教程,javascript教程">
When users search for these keywords in search engines, your website will appear in the results. However, because many cheaters (black hat SEO) in the early days used keyword stuffing to cheat, now search engines (Baidu) is no longer so sensitive to keywords.
meta tag setting description
Grammar format:
<meta name=“discription” content=“描述的内容”>
The description of the web page is very important, you can directly It is reflected in the search engine. For example, open the Baidu website and search for "Sina" and you will see the following page
meta tag setting character set
Grammar format:
<meta http-equiv =“content-type” content=“text/html; charset="编码格式”>
Common The encoding formats include Chinese encoding (gbk2312) and international encoding (UTF-8). gbk2312 is Chinese encoding. If your website content is all in Chinese, use gbk2312. UTF-8 is universal for text around international encodings (including Chinese and English). ). The main difference between them is that gbk2312 is specially built for Chinese, and one Chinese character occupies 2 characters. UTF-8 is a universal Chinese character and occupies 3 bytes. In the early days, network bandwidth resources were scarce, so using gbk2312 encoding can save bandwidth. Improve the opening speed of web pages, but now our home bandwidth is 4M or above and completely ignore the bytes saved.
Example:
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" >
When we browse the web, most of us have encountered garbled pages. The encoding format is to let the browser parse in the set editing format. If the encoding format is not If used correctly, garbled characters will appear. So I recommend using the universal UTF-8 encoding, so that all browsers in the world can display normally when accessing our web pages.
meta tag sets automatic refresh time
Syntax format
<meta http-equiv=“refresh” content=“刷新间隔的时间”>
The refresh time is in seconds. For example, the forum page can only see new posts after refreshing. Pages like this that update quickly can add automatic refresh code. Make sure you can see the latest page.
Example:
XML/HTML CodeCopy content to clipboard
<meta http-equiv=“refresh” content=“3”>
Here we demonstrate setting the time to 3 seconds, please test it yourself.
meta tag setting automatically jumps to new Page
Grammar format
<meta http-equiv=“refresh” content=“跳转间隔的秒数; Url="新网页地址”>
Example
<meta http-equiv=“refresh” content=“3; Url="http://www.adminwang.com”>
When the browser opens this page, it will automatically jump to the homepage of our website after 3 seconds.
meta tag setting disables caching
Syntax format
<meta http-equiv="cache-control" content="no-cache" />
We know that browsers have a caching mechanism, that is, opening a web page will automatically save it locally. The purpose of this is certain When accessing again within a certain period of time, the file in the cache will be directly called to improve the access speed. However, for pages that change from time to time like forums, we do not want the browser to save the cached file. This code can be added. There is another use in program development, the program If you want to always check the effect of code modification during debugging, you can use this code to disable browser cache.
Another way to write:
<meta http-equiv="pragma" content="no-cache" >
The above is the detailed content of Summary of HTML meta tag usage. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

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

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

Guide to Table Border in HTML. Here we discuss multiple ways for defining table-border with examples of the Table Border in HTML.

This is a guide to Nested Table in HTML. Here we discuss how to create a table within the table along with the respective examples.

Guide to HTML margin-left. Here we discuss a brief overview on HTML margin-left and its Examples along with its Code Implementation.

Guide to HTML Table Layout. Here we discuss the Values of HTML Table Layout along with the examples and outputs n detail.

Guide to HTML Input Placeholder. Here we discuss the Examples of HTML Input Placeholder along with the codes and outputs.

Guide to the HTML Ordered List. Here we also discuss introduction of HTML Ordered list and types along with their example respectively

Guide to Moving Text in HTML. Here we discuss an introduction, how marquee tag work with syntax and examples to implement.

Guide to HTML onclick Button. Here we discuss their introduction, working, examples and onclick Event in various events respectively.
