Home > Web Front-end > HTML Tutorial > How to set web page encoding in html

How to set web page encoding in html

青灯夜游
Release: 2023-01-11 09:19:50
Original
15437 people have browsed it

In HTML, you can use the charset attribute of the meta tag to set the web page encoding. This attribute can define the character encoding of the HTML document. The syntax format is ""; encoding method Can be set to "UTF-8", "gb2312", etc.

How to set web page encoding in html

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

In HTML, you can use the charset attribute of the meta tag to set the web page encoding. The

tag provides metadata for an HTML document. Metadata is the data information of the data; metadata will not be displayed on the client, but will be parsed by the browser.

The META element is usually used to specify the description, keywords, last modification time of the file, author and other metadata of the web page.

Metadata can be called using browsers (how content is displayed or pages are reloaded), search engines (keywords), or other web services.

In HTML5, there is a new charset attribute that can define the character encoding of the document, which makes character set definition easier:

  • HTML 4.01: <meta http-equiv="content-type" content="text/html; charset=UTF-8">

  • ##HTML5:

    < meta charset="UTF-8">

#Example: Set page encoding format

<!DOCTYPE html>
<html>
<head>
    <!-- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />--> <!--HTML4写法,也是之前传统页面的写法-->
    <meta charset="utf-8"><!-- HTML5也就是H5的写法 -->
</head>
<body>
</body>
</html>
Copy after login

Recommended tutorial: "

html video tutorial

The above is the detailed content of How to set web page encoding in html. 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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template