English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
The charset attribute specifies the character encoding of the HTML document. The format is: <meta charset="UTF-8">
Specify the character encoding of the HTML document:
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>HTML: <meta> charset attribute - Basic Tutorial Network(oldtoolbag.com)</title> </head> <body> <h1>My Website</h1> <p>Some text.../p> </body> </html>Test to see ‹/›
IEFirefoxOperaChromeSafari
All major browsers support the charset attribute.
The charset attribute specifies the character encoding of the HTML document.
Tip:charset attribute can be overridden by the lang attribute on any element.
charset attribute is HTML5The new features added in, replacing the need for the following content: <meta http-equiv ="Content-Type" content ="text / html; charset = UTF-8">.
Still allows the use of http-The equiv attribute specifies the character set, but the new method requires less code.
<meta charset="character_set">
Value | Description |
---|---|
character_set | Specifies the character encoding of the HTML document. Common values:
In theory, any character encoding can be used, but not all browsers can understand them. The more widely a character encoding is used, the more likely a browser is to understand it. To view all available character encodings, please visit IANA Character Set. |