Pseudo-class elements before and after set img icon size

When adding icons before / after pseudo-class elements, generally if there are not many prominent icons, you can directly download the image from the Alibaba Cloud Vector Library, and then set it. However, it is found that the size is uncontrollable, so the method of turning it into a background image is adopted.

The reference css is as follows:

 p::before {
            content: "";
            display: inline-block;
            width: 20px;
            height: 20px;
            background: url("./gg.png");
            background-size: cover;
        }

Guess you like

Origin blog.csdn.net/enhenglhm/article/details/123266046