Open In App

HTML <a> charset Attribute

Last Updated : 11 Mar, 2024
Improve
Improve
Like Article
Like
Save
Share
Report

HTML <a> charset attribute specifies the character encoding for an external resource linked with the HTML anchor element. It ensures proper interpretation of text by defining the character set used in the linked resource.

Note: It is not supported by HTML5.

Syntax:

<a charset="value">

Attribute Values:

It contains the value charset which specifies the character encoding for the external scripts.

  • “ISO-8859-1”: It is used for the Standard encoding for the Latin alphabet.
  • “UTF-8”: It is used for the Character encoding for Unicode. Compatible with ASCII.

HTML <a> charset Attribute Examples

Example: This example display the use of charset attribute of anchor tag

HTML




<!DOCTYPE html>
<html>
 
<head>
    <title>
        HTML a charset Attribute
    </title>
</head>
 
<body>
    <p>Welcome to
        <a charset="UTF-8"
           href="https://ide.geeksforgeeks.org/">
            GeeksforGeeks
        </a>
    </p>
</body>
 
</html>


Output:

HTML anchor charset attribute

Explanation:

  • In the above example The HTML <a> element creates a hyperlink.
  • The charset attribute specifies the character encoding for the linked resource.
  • In the example, charset=”UTF-8″ ensures proper interpretation of characters.
  • It’s typically used with external resources like stylesheets and scripts.

Supported Browsers

  • No browser supports

.


Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads