Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!
  • Guest, before posting your code please take these rules into consideration:
    • It is required to use our BBCode feature to display your code. While within the editor click < / > or >_ and place your code within the BB Code prompt. This helps others with finding a solution by making it easier to read and easier to copy.
    • You can also use markdown to share your code. When using markdown your code will be automatically converted to BBCode. For help with markdown check out the markdown guide.
    • Don't share a wall of code. All we want is the problem area, the code related to your issue.


    To learn more about how to use our BBCode feature, please click here.

    Thank you, Code Forum.

HTML & CSS linear-gradient text for small words

[CODE lang="css" title="linear-gradient"].halloween {
background-image: linear-gradient(to left, black, orange);
-webkit-background-clip: text;
-moz-background-clip: text;
background-clip: text;
color: transparent;
}

.christmas {
background-image: linear-gradient(to left, green, crimson);
-webkit-background-clip: text;
-moz-background-clip: text;
background-clip: text;
color: transparent;
} [/CODE]

Using these CSS classes I want to be able to change the color of words to reflect these classes in their entire gradient. This works for larger words and phrases, but for smaller words, like "Christmas Day" for .christmas, or "Halloween" for .halloween, the change isn't complete, especially since the font is 12px:

[CODE lang="html" title="HTML"]<span id="halloween" class="halloween">Halloween</span><br /><br />
<span id="christmas" class="christmas">Christmas</span> [/CODE]

Does anyone know any other tricks that I would need to do to ensure that the gradient takes place for even smaller words, or is it even possible?

Thanks
 
The text is too small to see the complete gradient. E.g., "Christmas" should go from crimson to green, but it remains in crimson with a slight change toward red; I want it to go all of the way to green, and I want to be able to have that happen to all words regardless of reasonable length, if at all possible
 

Buy us a coffee!

Back
Top Bottom