Open In App

HTML <a> charset Attribute

Last Updated : 05 May, 2025
Comments
Improve
Suggest changes
Like Article
Like
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.

Usage

  • The charset attribute defines the character encoding for the webpage.
  • It is used in the <meta> tag, usually in the <head> section (e.g., <meta charset="UTF-8">).
  • UTF-8 is the most common encoding, supporting a wide variety of characters and symbols.

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://www.geeksforgeeks.org/community/">
			GeeksforGeeks
		</a>
	</p>
</body>
</html>

Output:

Charset-
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

.


Next Article

Similar Reads