×

CSS Text-Transform Property

Text-Transform in CSS

The text-transform property permits us to alter the text case. It controls the capitalization of the text. This property is employed to design the text appearance in every uppercase or every lowercase, or it may transform each word’s first character to uppercase.

Syntax:

text-transform: capitalize| uppercase| lowercase| none| initial| inherit;

 Let’s understand the above property values one by one with an example.

  • Capitalize

It transforms each word’s first character to uppercase. But, it can’t change any first letter after any number into the capitalized form. It can affect any word’s first letter only, rather changing the other letters of any word.

The letter in any word that has already defined in the capitalized form will not be switched to the lowercase form by using this property.
The example to describe the capitalize property is illustrated below:

Syntax:

text-transform: capitalize;

Example:

<!DOCTYPE html>
<html>
<head>
<title> Text-transform Property </title>
<style>
body
{
 text-align: center;
}
h1
{
 color: navy;
}
p
{
text-transform: capitalize;
}
</style>
</head>
<body>
<center>
<h1> Text-transform Property in CSS </h1>
<h2> text-transform: capitalize </h2>
<p> Hello World! </p>
<p> Welcome to this Page </p>
</body>
</html>

Output:

CSS Text-Transform
  • uppercase

As the name suggests, it transforms word’s every character into uppercase.

Syntax:

text-transform: uppercase;

Example:

<!DOCTYPE html>
<html>
<head>
<title> Text-transform Property </title>
<style>                
body
{
 text-align: center;
}
h1
{
 color: navy;
}
p
{
text-transform: uppercase;
}
</style>
</head>
<body>
<center>
<h1> Text-transform Property in CSS </h1>
<h2> text-transform: uppercase </h2>
<p> Hello World! </p>
<p> Welcome to this Page </p>
</body>
</html>

Output:

CSS Text-Transform
  • lowercase

This property can transform word’s every character into lowercase.

Syntax:

text-transform: lowercase;

Example:        

<!DOCTYPE html>
<html>
<head>
<title> Text-transform Property </title>
<style>
body
{
 text-align: center;
}
h1
{
 color: navy;
}
p
{
text-transform: lowercase;
}
</style>
</head>
<body>
<center>
<h1> Text-transform Property in CSS </h1>
<h2> text-transform: lowercase </h2>
<p> HELLO WORLD! </p>
<p> WELCOME TO THIS PAGE </p>
</body>
</html>

Output:

CSS Text-Transform
  • none

This property does not provide any capitalization and it is defined as a default value. It delivers any text form as it is.

Syntax:

text-transform: none;

Example:

<!DOCTYPE html>
<html>
<head>
<title> Text-transform Property </title>
<style>
body
{
 text-align: center;
}
h1
{
 color: navy;
}
p
{
text-transform: none;
}
</style>
</head>
<body>
<center>
<h1> Text-transform Property in CSS </h1>
<h2> text-transform: none </h2>
<p> Hello World! </p>
<p> Welcome to this Page </p>
</body>
</html>

Output:

CSS Text-Transform

Related Topics

CSS Introduction

CSS stands for Cascading Style Sheet. It is a design language which is used to design the web pages. It was developed by Håkon Wium Lie on October 10, 1994. It provides...

1 minute read.

CSS Checkbox style

CSS Checkbox style: It is an element of HTML, which is used to get input from various users. It is difficult to style any checkbox. However, some elements make it...

6 minutes read.

CSS :root selector

CSS :root selector This CSS pseudo-class matches any document’s root element. It chooses the parent of the highest-level inside the document DOM or tree. An element of <html> is always a...

2 minutes read.

CSS Selector

CSS Selector: There are some selectors used in CSS, which allows us to choose the content we wish to style. Various selectors are considered as the separation of the set...

5 minutes read.

CSS Text-stroke

Text-stroke Text-stroke CSS property inserts the stroke to any text and gives a decoration option to them also. It describes the stroke’s width and color for various text characters. It is...

2 minutes read.

CSS Hover

CSS Hover: CSS :hover is used to select the various elements whenever we point the mouse on these elements. We can also use this selector on all the HTML elements,...

3 minutes read.

CSS Page-break-inside Attribute

Page-break-inside Attribute As its name implies, the page-break-before property is applied to include page break inside any element, at the time of printing any document. It adds the page break before...

3 minutes read.

CSS Background

CSS Background The properties of CSS background are applied to describe the effects of background on the element. Here are five properties of background that affects various elements of HTML: Background-colorBackground-imageBackground-repeatBackground-attachment Background-position Background-color The color of the background...

7 minutes read.

CSS Position

CSS Position: The position property in CSS is applied to set the position of the elements. It can be used to position the backside of an element. It is also...

3 minutes read.

CSS Descendant Selector

Descendant Selector The Descendant selector in CSS is used to match the descendant components of a particular component. The term descendant depicts nested in whatever place, inside a DOM tree. This...

2 minutes read.

CSS Loader

CSS Loader The loader is the animation that can alert a visitor regarding the loading of the page. We need to wait for some time. It will be helpful if any...

4 minutes read.

CSS Outline

CSS Outline: This CSS property is quite similar to the border property of CSS. It eases us to design an additional border around the element to obtain visual attention. The...

4 minutes read.

CSS Links

CSS Link is used to create styled link. There are various ways to implement it. Styling Links Link can be styled with CSS properties like color, font-family, background etc. Example: <!DOCTYPE html>   <html>   <head>   <style>   a {       color: red;   }   </style>   </head>   <body>   <p><b><a href="https://www.tutorialandexample.com"    target="_blank">This is a link</a></b></p>   </body>   </html> Try Now There are four...

2 minutes read.

CSS Visibility

Visibility in CSS: This visibility property in CSS is employed to describe whether the components are visible or not. Note: An invisible component also grabs the space over the page. If...

2 minutes read.

CSS Justify Content

Justify Content: These properties are applied for the alignment of items of a flexible box container if any item does not cover every available space over the main-axis, i.e., horizontally....

4 minutes read.

CSS Zoom

CSS Zoom: Zoom property in CSS extents the content. This property controls the content’s level of magnification. Rather than the use of this CSS property, we may also apply the...

3 minutes read.

CSS Filter

CSS Filter CSS filter is used to apply visual effects on the images, text, and other factors of the webpage. This filter property in CSS allows us to admit the effects like...

7 minutes read.

CSS Form

You can create attractive HTML form by using CSS. Style input Fields The Input Field width properties are used to determine the width of the input field. Let us see an example of CSS style...

2 minutes read.

CSS Gradient

CSS Gradient: The CSS gradient property is applied to show the smooth transition inside two specified colors or more than two specified colors. Need of CSS Gradient The following are a few...

4 minutes read.

CSS Specificity

CSS Specificity: If one or more conflicting rules of CSS express a similar element, a browser will pursue a few rules to examine the specific one. Specificity can be specified...

3 minutes read.