Home >Web Front-end >HTML Tutorial >Make HTML5 canvas fill the entire page

Make HTML5 canvas fill the entire page

WBOY
WBOYforward
2023-08-29 19:53:02837browse

Make HTML5 canvas fill the entire page

For the canvas to fill the entire page, the width and height of the page need to be 100%.

* {
   margin: 0;
   padding: 0;
}
body, html {
   height:100%;
}
#canvas {
   position:absolute;
   height:100%; width:100%;
}

The above is the detailed content of Make HTML5 canvas fill the entire page. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:tutorialspoint.com. If there is any infringement, please contact admin@php.cn delete