why there is a White space on the top on html2canvas?

There is a white space on my html2canvas and I am not sure what is going on. This is my code so far.

function doFunction() {

  html2canvas(document.querySelector("#capture"), ).then(canvas => {

$("button").click(function() {
div {
  box-sizing: border-box;
  font-family: 'ABeeZee', sans-serif;

body {
  background-color: red;

#capture {
  width: 900px;
  height: 900px;
  background-color: aqua;
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="http://html2canvas.hertzen.com/dist/html2canvas.js"></script>
<div id="capture">
<button type="button">Click Me!</button>

This is the appended canvas. Notice there is a white space on the top. How can I remove it?

enter image description here

Leave a Comment