Understanding of CSS Text Transformation property & their values

naveen-golla , Credit to  volkotech-solutions May 09

Make your website text content more readable with these top 6 CSS text transformations: upper/lower cases, capitalize, initial, inherit, none, and unset.

The following are seven simple CSS text transformations that can help increase your website readability:

  1. Uppercase and Lowercase Transformations
  2. Capitalize Transformations
  3. Initial
  4. Inherit
  5. None
  6. Unset 

Uppercase and Lowercase Transformations

The purpose of using CSS's uppercase and lowercase transformations is to modify the appearance of text in order to improve its consistency and readability. Using CSS to apply these transformations also offers the advantage of separating presentation from content, making it easier to update and modify the look of your text without having to change the actual text content.

By converting all or part of a text block to uppercase or lowercase, you can make it easier for readers to follow along and understand the information presented. This is especially useful for headings or titles where consistency is key, or for body copy where lowercase text can be easier on the eyes.

Overall, the use of uppercase and lowercase transformations in CSS can improve the usability and overall aesthetic appeal of your website's text content.

Good and bad practices of text transformations using uppercase and lowercase:

Here's an example of good practices for using text-transform uppercase and lowercase:

h1{
  font-size: 32px;
  text-transform: uppercase;
}
.body-content{
  font-size: 18px;
  line-height: 1.5;
  text-transform: lowercase;
}

Text-transform uppercase and lower case

Here's an example of Bad practices for using text-transform uppercase and lowercase:

h1{
  font-size: 32px;
  text-transform: lowercase;
}
.body-content{
  font-size: 18px;
  line-height: 1.5;
  text-transform: uppercase;
}

Text-transform uppercase and lower case

Capitalize Transformations

The use and purpose of using CSS's capitalize transformations is to modify the appearance of text by capitalizing the first letter of each word in a text block. This can help improve the readability and visual appeal of headings and titles by making them more consistent and easier to scan.

Using CSS to apply to capitalize transformations also provides the benefit of separating presentation from content, allowing you to update or modify the look of your text without changing the actual text content.

Overall, the use of capitalize transformations in CSS can help improve the readability and visual appeal of your website's text content, making it easier for readers to understand and engage with the information presented.

Here is the CSS code for text-transform capitalize:

h1{
  font-size: 32px;
  text-transform: capitalize;
}

.body-content{
  font-size: 18px;
  line-height: 1.5;
  text-transform: capitalize;
}

Text-transform capatilize

Letter Spacing

The use of "Letter Spacing" in CSS is to adjust the amount of space between individual letters in a text block. This can help improve the readability and overall looks attract of text content by increasing or decreasing the spacing between letters. Slightly increasing the letter spacing can make the text easier to read, especially for longer blocks of text, while decreasing it can create a more condensed and stylized look.

Here is the CSS code for Letter spacing:

The letter-spacing property increases or decreases the space between characters in a text.

/* Letter-spacing increase: */

p{
  font-size: 18px;
  line-height: 1.5;
  color: #666666;
  letter-spacing: 3px;
}

/* Letter-spacing Decrease: */

p{
  font-size: 18px;
  line-height: 1.5;
  color: #666666;
  letter-spacing: -1px;
}

Letter spacing increase, decrease and default values

Initial

The initial value of a CSS property is its default value. The use of the initial value depends on whether a property is inherited or not:

For example, the inherited properties are the initial value is used on the parent element only, since no specified value is provided.

For non-inherited properties, the initial value is used on all elements, since no specified value is provided.

Inherit

When no value for an inherited property has been specified on an element, the element gets the computed value of that property on its parent element. Only the root element of the document gets the initial value given in the property's summary.

A normal example of an inherited property is the text-transform property. Think about the following style rules applied for the div element, the p tag inherits the property from its parent div element.

div{
  Text-transform: uppercase;
}

container has text-transform upper case

None

In CSS, "text-transform: none" is a property that you can apply to a text element, such as a paragraph or a heading. It means that the text will not be transformed or modified in any way.

By default, the text is displayed in its original form, with uppercase and lowercase letters as they were written. However, you can use other text-transform values to modify the appearance of the text, such as "uppercase" to make all the letters uppercase, or "capitalize" to capitalize the first letter of each word.

By default, paragraphs or headings will be inherited the properties from parent elements. Since we can provide the specific value.

For example, if the parent element has a text-transform uppercase property the property will be inherited by its child elements. When we specifically provide any property then it will not inherit.

.parent{
  text-transform: uppercase;
}

.child{
  text-transform: none; 
}

text transform none

Unset

In CSS, the "text-transform: unset;" property is used to revert any previously set text transformations back to their default values.

So, "text-transform: unset;" is useful when you want to remove any previous text transformations and display the text in its original format.

Conclusion

In this blog, we have successfully learned about how to manage text transformations to keep your website clean and have clear readability. Hope you learn something new from this blog.Thank you for taking the time to read.

Comments

Authors

Read Next