Open In App

SVG xml:lang Attribute

Improve
Improve
Like Article
Like
Save
Share
Report

The xml:lang attribute in SVG is used to indicate the primary language that is used in the contents and attributes containing text content on the website. It is allowed in all XML dialects as it is a universal attribute. All elements use this attribute.

Syntax:

xml:lang = "language-tag"

Attribute Values: The attribute accepts values as mentioned above and described below:

  • language-tag: This value indicates the language used for the given element. The language is defined according to the BCP 47 specification.

Example 1:

HTML




<!DOCTYPE html>
<html>
  
<body>
    <h1 style="color: green; 
            margin-left: 80px;">
        GeeksforGeeks
    </h1>
  
    <svg viewBox="-5 -20 800 100" 
        xmlns="http://www.w3.org/2000/svg">
          
        <text xml:lang="en-US">
            It is a Computer
            Science portal.
        </text>
    </svg>
</body>
  
</html>


Output:

Example 2:

HTML




<!DOCTYPE html>
<html>
  
<body>
    <h1 style="color: green; 
            margin-left: 100px;
            font-size: 30px;">
        GeeksforGeeks
    </h1>
      
    <svg viewBox="20 -10 200 100" 
        xmlns="http://www.w3.org/2000/svg">
        <text xml:lang="ar">
            Ù…رحبا
        </text>
    </svg>
</body>
  
</html>


Output:



Last Updated : 10 Dec, 2020
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads