Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to partially fill text with different colours? [duplicate]

Tags:

css

canvas

svg

Here is what I'm trying to achieve: enter image description here

Is there a way to do this with a W3 web technology, e.g. SVG, Canvas?

like image 273
Matt Deacalion Avatar asked Apr 01 '18 20:04

Matt Deacalion


People also ask

How do you make multicolor text?

Another way is creating a text with separate elements by using the HTML <span> tag, which is an empty container. This means that you create a multicolor text by putting each letter in a separate element to define a different color for each letter of your text.

What is text fill color?

The text-fill-color property specifies the fill color of characters of the text. If this property is not specified, the value of the color property is used. The text-fill-color and the color properties are the same, but the text-fill-color takes precedence over the color if the two have different values.

How do I make text a different color in HTML?

<FONT COLOR= > To change some of the text in the HTML document to another color use the FONT COLOR Tag. To change the color of the font to red add the following attribute to the code to the <FONT COLOR=" "> tag. #ff0000 is the color code for red.


1 Answers

Yes, you can, by using the text-fill-color and background-clip properties.

html, body {
  background: #000;
}

p {
  margin: 0px;
}

#clip {
  background: linear-gradient(to right, rgba(127, 127, 127, 1) 23%, rgba(234, 85, 7, 1) 20%, rgba(234, 85, 7, 1) 57%, rgba(127, 127, 127, 1) 59%);
  background-attachment: fixed;
  -webkit-text-fill-color: transparent;
  -webkit-background-clip: text;
  font-size: 8vw;
  font-weight: bold;
  text-align: center;
}
<p id="clip">Lorem ipsum dolor sit </p>

NOTE: Visit this link for more information.

like image 186
Taki Avatar answered Nov 06 '22 05:11

Taki