Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible with CSS to make text's color fade between two colors?

Tags:

html

css

I'm hoping to achieve the effect in the following design.

enter image description here

Possible without using images?

fiddle: https://jsfiddle.net/8k66bwbk/

.blue-fade
{
    font-size: 40px;
    font-family: Helvetica,Arial,sans-serif;
    font-weight: 100;  
    color: #1ba0d7;
}
like image 865
Subpar Web Dev Avatar asked Feb 07 '23 21:02

Subpar Web Dev


2 Answers

Do you want something like that?

.blue-fade {
  font-size: 40px;
  font-family: Helvetica,Arial,sans-serif;
  font-weight: 100; 
  background: -webkit-linear-gradient(#1ba0d7, #002d3f);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
<p class="blue-fade">
368%
</p>

https://jsfiddle.net/9dx4fcrz/

like image 70
XsMeJkY Avatar answered Feb 16 '23 04:02

XsMeJkY


You can also change fade by opacity. Here is an example with hover.

.blue-fade
{
    font-size: 40px;
    font-family: Helvetica,Arial,sans-serif;
    font-weight: 100;  
    color: #1ba0d7;   
}

.blue-fade:hover {
   opacity: 0.5;
 }
<h2 class="blue-fade">
Subheadline
</h2>
like image 42
aGer Avatar answered Feb 16 '23 02:02

aGer