Target SVG included as OBJECT with CSS from parent

2019-05-06 03:46发布

Is it possible to target SVG elements inside an OBJECT tag using CSS from the parent document?

<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <style type="text/css">

        /* This should target the element with id `icon-so`
           inside the `img/so.svg` file */
        #icon-so{
            fill: red;
        }

    </style>
</head>
<body>

  <object type="image/svg+xml" data="img/icon-so.svg">so logo</object>

</body>
</html>

标签: html css svg
0条回答
登录 后发表回答