Computer >> Computer tutorials >  >> Programming >> Javascript

Is it possible to have an HTML canvas element in the background of my page?


Yes, try to set the CSS style with position: fixed (or absolute):

canvas{
   position:absolute;
   left:0;
   top:0;
   z-index:-1;
}

You can also set it to the following:

<style>
   #canvasSection{
      position:fixed;
   }
</style>