How to apply CSS to half of a character?

Sometimes, we want to apply CSS to half of a character.

In this article, we’ll look at how to apply CSS to half of a character.

How to apply CSS to half of a character?

To apply CSS to half of a character, we set the background.

For instance, we write

h1 {
  display: inline-block;
  margin: 0;
  line-height: 1em;
  font-family: helvetica, arial, sans-serif;
  font-weight: bold;
  font-size: 300px;
  background: linear-gradient(to right, #7db9e8 50%, #1e5799 50%);
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

to set the background property to set the background to a gradient for the h1 element.

Then we set background-clip to text to make the background apply to the text.

Conclusion

To apply CSS to half of a character, we set the background.