Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fill property in CSS class not works for SVG #565

Closed
mndzielski opened this issue Oct 2, 2020 · 2 comments
Closed

Fill property in CSS class not works for SVG #565

mndzielski opened this issue Oct 2, 2020 · 2 comments

Comments

@mndzielski
Copy link

Hi,

I've discovered that fill property in CSS class is ignored for SVG. In the same example using fill with style or as property works fine.

Code:

<!DOCTYPE html PUBLIC "-//OPENHTMLTOPDF//DOC XHTML Character Entities Only 1.0//EN"  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html lang="en">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"/>
    <title>Icons</title>
    <style type="text/css">

        @page {
            size: A4;
            margin: 16px;
        }

        .mb-2 {
            margin-bottom: 16px;
        }

        .icon {
            fill: #FF6347;
        }
    </style>
</head>
<body>
<div class="mb-2"> Icon - fill property:</div>
<div class="mb-2">
    <svg height="16" width="16" viewBox="0 0 16 16" fill="#FF6347"
         xmlns="http://www.w3.org/2000/svg">
        <path d="M8 0l2.5 5.3 5.5.8-4 4.1.9 5.8L8 13.3 3.1 16l.9-5.8-4-4.1 5.5-.8z"
              fill-rule="evenodd"></path>
    </svg>
</div>

<div class="mb-2"> Icon - fill style:</div>
<div class="mb-2">
    <svg height="16" width="16" viewBox="0 0 16 16" style="fill: #FF6347;"
         xmlns="http://www.w3.org/2000/svg">
        <path d="M8 0l2.5 5.3 5.5.8-4 4.1.9 5.8L8 13.3 3.1 16l.9-5.8-4-4.1 5.5-.8z"
              fill-rule="evenodd"></path>
    </svg>
</div>

<div class="mb-2"> Icon - fill class:</div>
<div class="mb-2">
    <svg class="icon" height="16" width="16" viewBox="0 0 16 16"
         xmlns="http://www.w3.org/2000/svg">
        <path d="M8 0l2.5 5.3 5.5.8-4 4.1.9 5.8L8 13.3 3.1 16l.9-5.8-4-4.1 5.5-.8z"
              fill-rule="evenodd"></path>
    </svg>
</div>
</body>
</html>

The result:

image

As you see, in last case the star is black.

@syjer
Copy link
Contributor

syjer commented Oct 5, 2020

hi @mndzielski this is a limitation in how the "copy the css to svg backend" has been implemented. See: #515 .

As a workaround you can use:

.icon > path {
  fill: #FF6347;
}

@mndzielski
Copy link
Author

Hi @syjer, it works fine since version 1.0.4

Please update documentation for another users, thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants