How to apply CSS to half of a character?

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

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

How to apply CSS to half of a character?

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

For instance, we can 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;
}

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

For making the background, we set background-clip to text apply to the text.

Conclusion

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

Leave a Reply