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

opacity bug #2296

Closed
is-liyiwei opened this issue Jul 23, 2020 · 0 comments · Fixed by #2450
Closed

opacity bug #2296

is-liyiwei opened this issue Jul 23, 2020 · 0 comments · Fixed by #2450

Comments

@is-liyiwei
Copy link

Look .container css annotation


<!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" />
    <title>Document</title>
    <style>
      * {
        margin: 0;
        padding: 0;
        box-sizing: border-box;
      }

      .container {
        background-color: aquamarine;
        width: 200px;
        height: 200px;
        /* If container above this overflow style, child element opacity failure */
        overflow: hidden;
      }
      .opacity {
        opacity: 0.3;
      }
    </style>
  </head>

  <body>
    <div class="container">
      <div class="opacity">text</div>
      <div class="opacity">
        longtextlongtextlongtextlongtextlongtextlongtextlongtextlongtext
      </div>
    </div>
  </body>
  <script src="http://html2canvas.hertzen.com/dist/html2canvas.min.js"></script>
  <script>
    let target = document.querySelector(".container");
    html2canvas(target, {}).then((canvas) => {
      document.body.appendChild(canvas);
    });
  </script>
</html>

ysk2014 added a commit to ysk2014/html2canvas that referenced this issue Jul 27, 2020
ysk2014 added a commit to ysk2014/html2canvas that referenced this issue Jul 28, 2020
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

Successfully merging a pull request may close this issue.

1 participant