HTML <meta> charset Attribute

HTMLWeb DevelopmentFront End Technology

The charset attribute of the <meta> element is used to specify the character encoding for the HTML document. You can use the charset attribute on <meta> as well as <script> element.

Different charsets include ASCII, ANSI, ISO-8859-1, UTF-8, etc. ISO-8859-1 supports 256 different character codes. ASCII defined 128 different alphanumeric characters. The charset attribute in HTML is used with the <meta> to specify the character encoding.

Let us now see an example to implement the charset attribute of the <meta> element:

Example

 Live Demo

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
</head>
<body>
   <h1>Demo Heading</h1>
   <p>This is demo text.</p>
   <p>We are learning about the charset attribute of the meta element in HTML.</p>
</body>
</html>

Output

In the above example, we have set the charset using the <meta> element:

<meta charset="UTF-8">
raja
Published on 18-Jun-2019 10:42:05
Advertisements