DEV Community

Ed is Taking Note
Ed is Taking Note

Posted on • Updated on

[CSS Trick] Mask Image

We can use css mask to change the svg icon color.

<h1 class="text">AIRCRAFT</h1>
Enter fullscreen mode Exit fullscreen mode
.text::before {
  content: "";
  display: inline-block;
  height: 25px;
  width: 25px;
  margin-right: 8px;

  background-color: #eb2f64;
  -webkit-mask-image: url(../img/SVG/aircraft.svg);
  -webkit-mask-size: cover;
  mask-image: url(../img/SVG/aircraft.svg);
  mask-size: cover;
}
Enter fullscreen mode Exit fullscreen mode

Result:
Image description

Top comments (0)