Text with Gradient Background

Text with Gradient Background

Here’s something that looks fun.

Gradient Text!

Even Animation!

Here’s the fiddle:

Of course, you’d want it in your own colors, right?

So just head on over to
Ultimate CSS Gradient Editor
for the gradient css codes and

Gradient Animator
for the animation.

 

Now that you’re all ready with your links and css codes and stuff, we can dive in.

Basically, what we’re going to do is take those gradients and use them as backgrounds to punched-out text.

 

So we take two elements: the background, and the punched out text.

Here’s an example of a gradient:

h1.grad-back {
background: rgb(181,189,200); 
background: -moz-linear-gradient(left, rgba(181,189,200,1) 0%, rgba(130,140,149,1) 36%, rgba(40,52,59,1) 100%); 
background: -webkit-linear-gradient(left, rgba(181,189,200,1) 0%,rgba(130,140,149,1) 36%,rgba(40,52,59,1) 100%);
background: linear-gradient(to right, rgba(181,189,200,1) 0%,rgba(130,140,149,1) 36%,rgba(40,52,59,1) 100%); 
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#b5bdc8', endColorstr='#28343b',GradientType=1 ); }

and here’s some punched out text:

.clipped {
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;}

Add them together, and we get:

h1.grad-back {
background: rgb(181,189,200); 
background: -moz-linear-gradient(left, rgba(181,189,200,1) 0%, rgba(130,140,149,1) 36%, rgba(40,52,59,1) 100%); 
background: -webkit-linear-gradient(left, rgba(181,189,200,1) 0%,rgba(130,140,149,1) 36%,rgba(40,52,59,1) 100%);
background: linear-gradient(to right, rgba(181,189,200,1) 0%,rgba(130,140,149,1) 36%,rgba(40,52,59,1) 100%); 
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#b5bdc8', endColorstr='#28343b',GradientType=1 ); 
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
}

So that’s the first one. The one with just the gradient background.

Here’s what the animation looks like:

h1.moving {
background: linear-gradient(270deg, #5b20ad, #2da9ef, #06b050, #e6da25);
background-size: 800% 800%;
-webkit-animation: blockbusteranimation 8s ease infinite;
-moz-animation: blockbusteranimation 8s ease infinite;
-o-animation: blockbusteranimation 8s ease infinite;
animation: blockbusteranimation 8s ease infinite;
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
}
@-webkit-keyframes blockbusteranimation {
    0%{background-position:0% 50%}
    50%{background-position:100% 50%}
    100%{background-position:0% 50%}
}
@-moz-keyframes blockbusteranimation {
    0%{background-position:0% 50%}
    50%{background-position:100% 50%}
    100%{background-position:0% 50%}
}
@-o-keyframes blockbusteranimation {
    0%{background-position:0% 50%}
    50%{background-position:100% 50%}
    100%{background-position:0% 50%}
}
@keyframes blockbusteranimation { 
    0%{background-position:0% 50%}
    50%{background-position:100% 50%}
    100%{background-position:0% 50%}
}

 
[sc name=”customcss”]

So it’s pretty cool!

However… One problem:
As is with everything good on the internet, this does not work on IE.
Notice the “-webkit” part? Yeah, it doesn’t work on IE. So, you should probably add an IE specific stylesheet that just gives the text a single color.

So there you have it! A pretty awesome way to get gradients behind your text without using images. (for the modern browser people)

PS. The Divi theme version will be up real soon, and the link is here.
 
[sc name=”learn css”]
 
[sc name=”responsive-ad”]
 
[sc name=”podcast”]
 
 

 

Photo by Sam Headland on Unsplash

Get Breakdance

Breakdance is, in my opinion, the best page/site builder on the market, which is why all my tutorials use Breakdance. It's also why I have an affiliate link. You don't pay extra, but I get a little commission, so it helps support the site. Thanks!

Get ACF Pro

Another essential plugin for site building. This isn't an affiliate link, it's just for convenience.

Get WP Codebox Pro

If you'd like an easier to use, and more advanced code management plugin (instead of just editing and making files yourself) then WP codebox pro is for you. Adding php, js, and even SCSS. Pretty nice! Affiliate link below.

Blank Plugin

Sort of blank. It's made to be easy to use with the tutorials. Download and edit any way you see fit.
    Leave a Reply

    Your email address will not be published. Required fields are marked *

    New tutorials

    Auto-updating Year in Footer
    Designing Beyond the Brief
    Disable Gutenberg Editor on some ACF pages
    ACF flexible content fields in Breakdance 2.4

    Got a question? ask!

    If you have any question about the content on this page, feel free to send me an email by clicking the button below.

    newsletter? sign up!

    Sign up to the newsletter for updates on tutorials, news, and offers.

    Join the cypher!

    An awesome membership program for Breakdance Builder users coupled with an inclusive, friendly community.

    Got a question?

    If you have a question about something on this page, send me an email, and hopefully I can answer, and we can solve it!