Open In App

HTML <link> charset Attribute

Last Updated : 03 Oct, 2024
Comments
Improve
Suggest changes
Like Article
Like
Report

The HTML <link> element's charset attribute specifies the character encoding for the linked resource, typically for external stylesheets or scripts. It was primarily used with links to external files, but it's now obsolete and rarely needed as encoding is usually specified directly in the file itself or through HTTP headers.

Syntax

<link charset="character_set">

Attribute Values

It contains a single value character_set which specifies the character encoding for the HTML document. The values of character_set are:

  • UTF-8: It specifies the character encoding for Unicode.
  • ISO-8859-1: It specify the character encoding for the Latin alphabet.

Example: In this example the charset attribute in the HTML <link> element specifies the character encoding (e.g., ISO-8859-1) for the linked resource.

html
<!DOCTYPE html> 
<html> 

<head> 
    <title> 
        HTML link charset Attribute 
    </title>
</head> 

<body style="text-align:center"> 
    <H1>GeeksforGeeks</H1> 
    
    <h2>HTML link charset Attribute</h2> 
    
    <link href="gfg.html" charset="ISO-8859-1"> 
</body> 

</html> 

Output:

Supported Browsers

The browser supported by HTML <link> charset attribute are listed below:

  • Google Chrome: Not Supported
  • Internet Explorer: Not Supported
  • Firefox: Not Supported
  • Safari: Not Supported
  • Opera: Not Supported

Next Article

Similar Reads