- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
HTML charset Attribute
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
<!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">
Advertisements