HTML 字符集

htmlweb developmentfront end technology更新于 2025/7/2 19:24:17

不同的字符集包括 ASCII、ANSI、ISO-8859-1、UTF-8 等。ISO-8859-1 支持 256 种不同的字符代码。ASCII 定义了 128 种不同的字母数字字符。HTML 中的 charset 属性与 <meta> 一起使用来指定字符编码。

以下是语法 −

<meta charset="char_set">

以上,char_set 是用于指定 HTML 文档字符编码的字符集。 

现在让我们看一个实现 HTML 字符编码的示例 −

示例

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
</head>
<body>
<h2>Example</h2>
<p>We have added demo text −</p>
   <textarea rows="4" cols="50">
   Here, we are mentioned the demo content. This is just to display an example of charset in an HTML document.
   </textarea>
   <br>
   <button type="button">Previous</button>
   <button type="button">Next</button>
</body>
</html>

输出


相关文章


有用资源