HTML | DOM Style textTransform Property
The Style textTransform property in HTML DOM is used to set or return the capitalization of text. It can be used to make the required text uppercase, lowercase or capitalize the first character of each word.
Syntax:
- It returns the textTransform property.
object.style.textTransform
- It is used to set the textTransform property.
object.style.textTransform = "capitalize|uppercase|lowercase| none|initial|inherit"
Property Values:
- capitalize: This value capitalizes the first letter of every word of the text.
Example:
<!DOCTYPE html><html><head><title>DOM Style textTransform Property</title></head><body><h1style="color: green">GeeksforGeeks</h1><b>DOM Style textTransform Property</b><p>The textTransform property can be usedto capitalize, uppercase or lowercasethe text.</p><pclass="content">GeeksforGeeks is a computer science portal.</p><buttononclick="setTransform()">Change textTransform</button><!-- Script to capitalize first characterof each word --><script>function setTransform() {elem = document.querySelector('.content');elem.style.textTransform = 'capitalize';}</script></body></html>chevron_rightfilter_noneOutput:
- Before clicking the button:

- After clicking the button:

- Before clicking the button:
- uppercase: This value transforms every letter of the text to uppercase.
Example:
<!DOCTYPE html><html><head><title>DOM Style textTransform Property</title></head><body><h1style="color: green">GeeksforGeeks</h1><b>DOM Style textTransform Property</b><p>The textTransform property can be usedto capitalize, uppercase or lowercasethe text.</p><pclass="content">GeeksforGeeks is a computer science portal.</p><buttononclick="setTransform()">Change textTransform</button><!-- Script to capitalize each character --><script>function setTransform() {elem = document.querySelector('.content');elem.style.textTransform = 'uppercase';}</script></body></html>chevron_rightfilter_noneOutput:
- Before clicking the button:

- After clicking the button:

- Before clicking the button:
- lowercase: This value transforms every letter of the text to lowercase.
Example:
<!DOCTYPE html><html><head><title>DOM Style textTransform Property</title></head><body><h1style="color: green">GeeksforGeeks</h1><b>DOM Style textTransform Property</b><p>The textTransform property can be used tocapitalize, uppercase or lowercase the text.</p><pclass="content">GeeksforGeeks Is A ComPuTer sCiEnce PortAL.</p><buttononclick="setTransform()">Change textTransform</button><script>function setTransform() {elem = document.querySelector('.content');elem.style.textTransform = 'lowercase';}</script></body></html>chevron_rightfilter_noneOutput:
- Before clicking the button:

- After clicking the button:

- Before clicking the button:
- none: It is the default value that specifies no transformation takes place.
Example:
<!DOCTYPE html><html><head><title>DOM Style textTransform Property</title><style>.content {width: 500px;/* Set text-transform before toobserve effect of 'none' */text-transform: capitalize;}</style></head><body><h1style="color: green">GeeksforGeeks</h1><b>DOM Style textTransform Property</b><p>The textTransform property can be usedto capitalize, uppercase or lowercasethe text.</p><pclass="content">GeeksforGeeks is a computer science portal.</p><buttononclick="setTransform()">Change textTransform</button><!-- Script to convert lower caseof each word --><script>function setTransform() {elem = document.querySelector('.content');elem.style.textTransform = 'none';}</script></body></html>chevron_rightfilter_noneOutput:
- Before clicking the button:

- After clicking the button:

- Before clicking the button:
- initial: This is used to set this property to its default value.
Example:
<!DOCTYPE html><html><head><title>DOM Style textTransform Property</title><style>.content {width: 500px;/* Set text-transform before toobserve effect of 'none' */text-transform: capitalize;}</style></head><body><h1style="color: green">GeeksforGeeks</h1><b>DOM Style textTransform Property</b><p>The textTransform property can be usedto capitalize, uppercase or lowercasethe text.</p><pclass="content">GeeksforGeeks is a computer science portal.</p><buttononclick="setTransform()">Change textTransform</button><!-- Script to change lower caseof each word --><script>function setTransform() {elem = document.querySelector('.content');elem.style.textTransform = 'initial';}</script></body></html>chevron_rightfilter_noneOutput:
- Before clicking the button:

- After clicking the button:

- Before clicking the button:
- inherit: It inherits the property from its parent element.
Example:
<!DOCTYPE html><html><head><title>DOM Style textTransform Property</title><style>#parent {/* Set text-transform of parent toobserve effect of 'inherit' */text-transform: uppercase;}.content {width: 500px;/* Set text-transform to initial to preventauto inheritance of parent */text-transform: initial;}</style></head><body><h1style="color: green">GeeksforGeeks</h1><b>DOM Style textTransform Property</b><p>The textTransform property can be used tocapitalize, uppercase or lowercase the text.</p><divid="parent"><pclass="content">GeeksforGeeks is a computer science portal.</p></div><buttononclick="setTransform()">Change textTransform</button><script>function setTransform() {elem = document.querySelector('.content');elem.style.textTransform = 'inherit';}</script></body></html>chevron_rightfilter_noneOutput:
- Before clicking the button:

- After clicking the button:

- Before clicking the button:
Supported Browsers: The browser supported by DOM Style textTransform property are listed below:
- Google Chrome
- Internet Explorer
- Firefox
- Opera
- Apple Safari
Recommended Posts:
- HTML | DOM Style top Property
- HTML | DOM Style right Property
- HTML DOM | Style pageBreakAfter Property
- HTML | DOM Style fontStyle Property
- HTML | DOM Style textDecorationColor Property
- HTML | DOM Style order Property
- HTML | DOM Style animationFillMode Property
- HTML | DOM Style lineHeight Property
- HTML | DOM Style columnCount Property
- HTML | DOM Style padding Property
- HTML | DOM Style outlineStyle Property
- HTML | DOM Style transitionProperty Property
- HTML | DOM Style clear Property
- HTML | DOM Style columns Property
- HTML | DOM Style textDecoration Property
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.

