"; the meta tag is used to provide metadata about the HTML document. When the charset attribute is added to the tag, the character encoding of the HTML document can be specified."> What is the statement to set the character set in html5-Front-end Q&A-php.cn

What is the statement to set the character set in html5

青灯夜游
Release: 2021-12-17 18:51:11
Original
2731 people have browsed it

html5 The statement to set the character set is " "; the meta tag is used to provide metadata about the HTML document. When the charset attribute is added to the tag, it can be specified The character encoding of the HTML document.

What is the statement to set the character set in html5

The operating environment of this tutorial: Windows 7 system, HTML5 version, Dell G3 computer.

In HTML5, you can use the tag to set the character set.

tag is used to provide metadata about the HTML document, such as page validity period, page author, keyword list, page description, etc. The data defined by the tag will not be displayed on the page, but will be parsed by the browser.

tag defines the syntax of the character set:

Copy after login

The charset attribute is used to specify the character encoding of the HTML document, for example, added in thetag The following statement:

Copy after login

can set the character encoding of the document to "UTF-8".

Differences between HTML 4.01 and HTML5

The charset attribute is a new attribute in HTML5 and replaces:

Still allows the use of the http-equiv attribute to specify the character set, but using the new method can reduce the amount of code.

Commonly used values for the charset attribute:

  • UTF-8 - Unicode character encoding

  • ISO-8859 -1 - Character encodings for the Latin alphabet

In theory, any character encoding can be used, but not all browsers understand them. The more widely a certain character encoding is used, the more likely browsers are to understand it.

To see all available character encodings, visit IANA Character Sets.

http://www.iana.org/assignments/character-sets

Expand knowledge: Other uses of tags

1. Define page description

Copy after login

Defining the description information of the page is beneficial to search engines.

tag defines the document title, name="description" defines the document description, and the description is usually longer than the title. </p></blockquote>

2. Define keywords

Copy after login

Keywords are used to provide search engines with information related to the page.

3. Define page author

Copy after login

Author information can be automatically extracted through some content management systems.

4. Refresh the page

Copy after login

The code in the above example is used to send an instruction to the browser so that the browser automatically refreshes the page after a specified time interval (30 seconds). In addition to specifying the time interval in the content attribute, you can also specify a link. In this case, the page will redirect to the page pointed to by the link after the specified time, as shown in the following example:

Copy after login

Related recommendations : "html video tutorial"

The above is the detailed content of What is the statement to set the character set in html5. 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!