Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS canvas width in % not works get converted to px Reply To: canvas width in % not works get converted to px

#189414
Senff
Participant

Maybe you misunderstood.

In the HTML/DOM, the canvas dimensions have to be defined in pixels. This sounds like it’s static, and technically it is, but you can resize and make it dynamic with CSS, and use percentages.

You can NOT use percentages in the HTML part.

See this pen for an example, where the canvas is 100% of the (outlined) container:

http://codepen.io/senff/pen/vEOwvY