Join date: Aug 22, 2022


change svg color in pseudo element

In this article, we'll show you how to change the color of an SVG path in CSS. This can be done by applying a pseudo-class that targets all SVG paths in your document. In this code example, we'll use a pseudo-element to change SVG's fill color. We can even use multiple pseudo-elements to switch between different colors. This is useful if you have more than one fill color in your SVG file.

Change svg color in pseudo element

By Rafvs on May 07, 2021 p:after {width: 48px;height: 48px;display: inline-block;content: '';-webkit-mask: url( no-repeat 50% 50%;mask: url( no-repeat 50% 50%;-webkit-mask-size: cover;mask-size: cover;}.red:after {background-color: red;}.green:after {background-color: green;}.blue:after {background-color: blue;}

Change Svg Color in Pseudo Element

More actions