translate
translate Attribute
The translate
attribute specifies if an element's text should be translated during localization:
""
oryes
: The text will be translated.no
: The text will remain untranslated.
Syntax
<element translate="yes | no">
Example
<p translate="no">Don't translate this!</p>
<p>This can be translated to any language.</p>
class="notranslate"
to prevent translation.Applicable to
The translate
attribute is a global attributes, meaning it can be applied to any HTML element.
Elements | Attribute |
---|---|
All HTML elements | translate |
Values
- yes: Specifies that the content should be translated.
- no: Specifies that the content should not be translated.
See also
- All global attributes
- The
HTMLElement.translate
property corresponds to this attribute. - HTML
lang
attribute
Conclusion
The translate
attribute in HTML controls whether an element’s text should be translated during localization. It helps ensure content is appropriately adapted for different languages. However, for certain situations, you can use the class="notranslate"
method for finer control over translation behavior.
title
The title attribute in HTML provides additional information about an element, typically displayed as a tooltip when the user hovers over it.
type
The type attribute in HTML determines the kind of input or form control, defining its purpose and the type of data it can handle, such as text, number, or date.