W3Schools.com

Style textTransform Property

Style Object Reference Style Object

Definition and Usage

The textTransform property sets or returns the case of a text.

Syntax

Set the textTransform property:

Object.style.textTransform="none|capitalize|uppercase|lowercase|inherit"

Return the textTransform property:

Object.style.textTransform

Value Description
none No characters are converted. This is 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
inherit The value of the textTransform property is inherited from parent element


Browser Support

Internet Explorer Firefox Opera Google Chrome Safari

The textTransform property is supported in all major browsers.


Example

Example

Convert the first letter of each word to uppercase:

<html>
<head>
<script type="text/javascript">
function displayResult()
{
document.getElementById("p1").style.textTransform="capitalize";
}
</script>
</head>
<body>

<p id="p1">This is some text.</p>
<br />

<button type="button" onclick="displayResult()">Convert text</button>

</body>
</html>

Try it yourself »


Style Object Reference Style Object
WEB HOSTING
Best Web Hosting
PHP MySQL Hosting
Best Hosting Coupons
UK Reseller Hosting
Cloud Hosting
Top Web Hosting
$7.95/mo SEO Hosting
Premium Website Design
WEB BUILDING
XML Editor - Free Trial!
FREE Website BUILDER
Free Website Templates Free CSS Templates
Make Your Own Website
W3SCHOOLS EXAMS
Get Certified in:
HTML, CSS, JavaScript, XML, PHP, and ASP
W3SCHOOLS BOOKS
New Books:
HTML, CSS
JavaScript, and Ajax
STATISTICS
Browser Statistics
Browser OS
Browser Display
SHARE THIS PAGE