HTML 字元集


不同的字元集包括 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>

輸出

更新日期:2019 年 7 月 30 日

234 次瀏覽

開啟你的 職業生涯

完成課程以獲得認證

開始學習
廣告
© . All rights reserved.