css改变svg的颜色

lanzhusiyu 2020-06-09

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <meta name="author" content="杨欣">
    <title>css改变svg的颜色</title>
    <style>
        .img {
            width: 100px;
            height: 100px;
        }

        .img img {
            width: 100%;
            height: 100%;
            filter: drop-shadow(red 100px 0);
            transform: translateX(-100px);
        }
    </style>
</head>

<body>
    <img  class="img" src="./logo.svg" alt="svg">
    <div class="img">
        <img src="./logo.svg" alt="svg">
    </div>
</body>

</html>

相关推荐