HTML translate Attribute

HTML translate Attribute: This attribute specifies whether the content of an element should be translated or not.

Test: Use the Google translate box (at the top of the page) to change to another language, and look at what happens to the word “ice cream” below:

Here we use translate=”no”: ice cream.

Here we use class=”notranslate”: ice cream.



HTML translate Attribute

This attribute can be applied to all the HTML elements.

Attribute Values

The translate attribute contains two value which is listed below:

yes: This attribute is used to specify that the content of the element can be translated.
no: This attribute is used to specify that the content of the element cannot be translated.

Syntax: <element translate = “yes|no”

Browser Support

This attribute is not supported by any browser.

Example:

<!DOCTYPE html> 
<html> 
  <head> 
    <title>translate attribute</title> 
   <style> 
  body { 
    text-align:center; 
       } 
  h1 { 
  color:green; 
     } 
    </style> 
   </head> 
  <body> 
    <h1>Freshersnow</h1> 
    <h2><strong >translate attribute</strong></h2> 
    <p translate="no">Don't translate this!</p> 
    <p>This can be translated to any language.</p> 
  </body> 
</html> 

Output:

HTML translate attribute