Feature text-spacing-trim in CSS

css text spacing trim guide
10 November 2024

Hello friends! Today we want to talk about a very interesting feature in CSS called text-spacing-trim. This feature helps web designers manage unwanted spaces in texts easily. Now let's see how we can make use of it.

Determining appropriate spaces in texts is one of the main tasks that every web designer faces. Sometimes, in the content, there are spaces that might seem very beautiful and it may be necessary to remove or adjust them.

In fact, text-spacing-trim allows you to decide whether you want to remove or keep a lot of spaces at the beginning or end of lines or not. This feature is especially useful when you want to ensure that your design always looks neat and professional.

By now, you may have wondered how to use this feature. Fortunately, using it is very simple. You just need a single line of code to manage everything. Let's take a look at the sample code below.


body {
text-spacing-trim: both;
}

Good! Here, we will explain further about the sample code to understand how we can apply it correctly.

text-spacing-trim: both;
This specifically indicates that we want to remove additional spaces at the start and end of lines. This will cause the texts to appear clearer and more organized.

Please note that currently, this feature is not supported in all browsers; therefore, before using it, be sure to check whether the target browsers can support it or not.

FAQ

?

What functionality does text-spacing-trim have in CSS?

?

Is text-spacing-trim supported in all browsers?