Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding a gradient color to text #151

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
22 changes: 22 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ A collection of tips to help take your CSS skills pro.
1. [Use Pointer Events to Control Mouse Events](#use-pointer-events-to-control-mouse-events)
1. [Set `display: none` on Line Breaks Used as Spacing](#set-display-none-on-line-breaks-used-as-spacing)
1. [Use `:empty` to Hide Empty HTML Elements](#use-empty-to-hide-empty-html-elements)
1. [Add a `gradient color` to text](#add-a-gradient-color-to-text)


### Use a CSS Reset
Expand Down Expand Up @@ -638,6 +639,27 @@ If you have HTML elements that are empty, i.e., the content has yet to be set ei
<sup>[back to table of contents](#table-of-contents)</sup>



### Add a `gradient color` to text

Multiple colors can be added to a text in form of a gradient with the use of `background`, `-webkit-background-clip` and `-webkit-text-fill-color`.

**Note:** It is important to note that the gradient effect is seen only when a minimum of two colors are used. You can add as many colors as you like.

```css
.gradient-text {
background: -webkit-linear-gradient(45deg, #112b8a, #ff0000);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
}
```

#### [Demo](https://codepen.io/Toyinn/pen/abJvXdo)

<sup>[back to table of contents](#table-of-contents)</sup>



## Support

Current versions of Chrome, Firefox, Safari, Opera, Edge, and IE11.
Expand Down