Style textTransform attribute

Definition and usage

textTransform Attribute sets or returns the case of the text.

This attribute is used to modify text to uppercase, lowercase, or capitalize the first letter.

See also:

CSS Tutorial:CSS κείμενο

CSS Reference Manual:text-transform attribute

Example

Example 1

Convert the first letter of each word in the <p> element to uppercase:

document.getElementById("myP").style.textTransform = "capitalize";

Try it yourself

Example 2

Convert all characters in the <p> element to uppercase:

document.getElementById("myP").style.textTransform = "uppercase";

Try it yourself

Example 3

Return the text transformation of the <p> element:

alert(document.getElementById("myP").style.textTransform);

Try it yourself

Syntax

Return textTransform attribute:

object.style.textTransform

Set textTransform attribute:

object.style.textTransform = "none|capitalize|uppercase|lowercase|initial|inherit"

Attribute value

Value Description
none No characters are converted. Default.
capitalize The first character of each word is converted to uppercase.
uppercase All characters are converted to uppercase.
lowercase All characters are converted to lowercase.
initial Set this attribute to its default value. See initial.
inherit This attribute is inherited from its parent element. See inherit.

Technical details

Default value: None
Return value: Σύμβολο που εκφράζει τη μετατροπή του κειμένου του στοιχείου.
Έκδοση CSS: CSS1

Υποστήριξη browser

Chrome Edge Firefox Safari Opera
Chrome Edge Firefox Safari Opera
Υποστήριξη Υποστήριξη Υποστήριξη Υποστήριξη Υποστήριξη