The HTML charset Attribute is used to specify the character encoding for the HTML document. The charset attribute could be overridden by using the lang attribute of any element.
Syntax:
<meta charset="character_set">
Attribute Values: It contains the value i.e character_set which specify the character encoding for the HTML document.
Values:
- UTF-8: It specify the character encoding for Unicode.
- ISO-8859-1: It specify the character encoding for the Latin alphabet.
Example: This Example illustrates the use of charset Attribute in Meta Element.
<!DOCTYPE html> < html >
< head >
< title >
HTML charset Attribute
</ title >
< meta name = "keywords" charset = "UTF-8"
content = "Meta Tags, Metadata" />
</ head >
< body style = "text-align:center" >
< H1 >Hello GeeksforGeeks!</ H1 >
< h2 >
HTML charset Attribute in Meta Element
</ h2 >
</ body >
</ html >
|
Output:
Supported Browsers: The browser supported by HTML <meta> Charset Attribute are listed below:
- Google Chrome
- Internet Explorer
- Firefox
- Opera
- Safari