Why are there two width and height values in the P5.js sketch canvas tag?

The canvas objects created by p5.js have two width and height values. I hadn’t noticed this before and now I’m curious!

The example below is the from the p5 editor.

<canvas id="defaultCanvas0" class="p5Canvas" style="width: 400px; height: 400px;" width="800" height="800"></canvas>
1 Like

I’m going to guess that this has to do with high DPI displays and pixel density, but that is just a guess.