user176105
user176105

Reputation: 221

2 Color CSS Icons

Is there a way to make css icons like Font Awesome (or any other CSS icons) have 2 colors?

I know they are fonts so the color can be changed by something like style='color: red;', but is there a way to use 2 colors for the icons like an accent color and a main color?

Upvotes: 2

Views: 1742

Answers (2)

Sean Stopnik
Sean Stopnik

Reputation: 1868

The only options you have are,

  1. You can use text-shadow to give it a different colored shadow or stroke.

  2. You would need to use svg icons to control the path colors.

Upvotes: 1

Amit
Amit

Reputation: 46323

You can utilize color & background-color to control 2 color on the same icon, as long as you only need 2 colors (no other background).

<i class="fa fa-motorcycle blue onred"></i>

.blue {
    color: blue;
}
.onred {
    background-color: red;
}

fiddle

Upvotes: 0

Related Questions