How to apply a Gradient to Text in CSS

Oscar de la Hera Gomez
Two flowers that represent ReactJS and CSS side by side, beneath them sits the text "Gradient Text."

Use the background, -webkit-background-clip and -webkit-text-fill-color CSS properties. Open Source code included.

We recommend that you clone our Open Source React-Redux Starter Project, checking out the main branch and apply the code found below to the App.tsx file. The changes can be found on the tutorial/typography/gradient branch.

git clone git@github.com:delasign/react-redux-starter-project.git

A screenshot of Chrome showing the letters "Aa" which are colored to match a gradient defined in the code below.

The code below creates an equally spaced gradient from left to right based on the hex colors defined in line 33.

The CSS properties that create this gradient are defined on lines 26 to 28.

For more information about the linear gradient and other gradient options consult the link below.

Looking to learn more about ReactJS and CSS ?

Search our blog to find educational content on learning how to use ReactJS and CSS.

Any Questions?

We are actively looking for feedback on how to improve this resource. Please send us a note to inquiries@delasign.com with any thoughts or feedback you may have.
delasign logo

Book a Free Consultation.

An icon of an email.

Click here to email us.

Fill in the details below to book a free consultation or to let us know about something else. Whatever it is, we are here to help.

How can we help you ?

Contact Details