Timeline for HTML5 Canvas 100% Width Height of Viewport?
Current License: CC BY-SA 3.0
8 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Sep 8, 2021 at 11:33 | comment | added | ceving |
@i336_ If you use for both lengths the unit vmin the aspect ratio will not change.
|
|
Oct 14, 2020 at 6:59 | comment | added | Andrew McOlash | There are cases where you want to stretch (i.e. progress bar). Thanks, great for my case! | |
May 10, 2016 at 1:56 | comment | added | i336_ | This method does not work, it stretches the text. You unfortunately have to use JS. | |
Jul 3, 2015 at 11:12 | history | edited | Vitalii Fedorenko | CC BY-SA 3.0 |
added 23 characters in body
|
Jul 3, 2015 at 2:32 | comment | added | Dan Dascalescu | @Daniel is right - this answer is wrong. It won't set the internal dimension of the canvas context, but rather the dimensions of the DOM element. For the difference, see my answer to a related question. | |
Aug 21, 2014 at 3:03 | comment | added | Vivian River | I tried this and found that in Chrome and Firefox, the canvas simply shows the image stretched to the full viewport. Even newly drawn elements are stretched, as well. | |
Aug 20, 2014 at 12:40 | comment | added | superlukas |
Add display: block; and it does the job.
|
|
May 27, 2013 at 0:14 | history | answered | Vitalii Fedorenko | CC BY-SA 3.0 |