"When you start on your journey to Ithaca, then pray that the road is long, full of adventure, full of knowledge... Always keep Ithaca fixed in your mind. To arrive there is your ultimate goal. But do not hurry the voyage at all." (from "Ithaca", by C. P. Cavafy)

Saturday, October 20, 2012

Gotcha - Html5 Canvas Acting Weird?

This could burn a little time if you're not careful.

The height/width attributes are used for the coordinate system of the canvas, while the css height/width properties are for the window itself.  If the height/width attributes are not set, then they default to 300 and 150, respectively.  The bottom line is that you should probably deal with these two height/width entities separately.

Here's one nice example on stackoverflow demonstrating the issue.  Here's another one.



Popular Posts

Powered by Blogger.