简体   繁体   中英

How can i change default max canvas size?

I saw on the Internet the different max size and area of a canvas. I would like to change them for my project because i create canvas of 5000px / 2600px. I test to put a smaller canvas (300px / 300px) and it works i've no error (NS_ERROR_FAILURE)

Thank's all

You may use CSS for that, in your webpage.

<head>
<style>
canvas{
       width: 300px;
       height: 300px;
}
</style>
</head>

Canvas size is device dependent. Have a look at Maximum size of a <canvas> element , this may help you to resolve the issue.

You can't change the maximum canvas size supported by a browser, but you can detect it and avoid creating canvas elements that exceed the browser's size limitations.

See my answer in the Maximum size of a <canvas> element thread for details.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM