I programmed a website with a game. The game has a fixed size and an ID. I used this so that the canvas is displayed on the website in the sectio. However, I don't know how to make the js canvas smaller with CSS so that it is the right size on laptops etc.
Does anyone know how I can manage to make the js canvas smaller despite the fixed size or whether there's an alternative?
The game was created with the P5 Library.
The canvas and all overlying containers (incl. Body tag) on:
display: block
width: 100%
height: 100%;
overflow: hidden;
Now you should have full screen.
However, the game will most likely be scaled like an image and out of focus at high magnification. It would be better to adjust the canvas resolution.
Thanks first of all. Does this also work if I don't want the game to be in full screen, but on a PC eg on 1400x700 but on a laptop on 900x500?