Canvas width and height

When using <canvas>, remember to add width and height attributes to the markup

<canvas width="200" height="300"></canvas>

even if you have defined them in the CSS, otherwise you might see some unexpected code behavior.


CSS Margin In Percentage

Okay, this is funny; but only if it doesn’t come in the way of you getting things done on time. I was trying to assign percentage margin to a <div> and it kept throwing me off on the calculations. A bit of googling led me to this explanation.

If you are giving padding/margin in percentage, due to some out-of-the-world reason it would calculate on the basis of the width of the parent element; whether you are calculating left-right values for margin/padding, or the top-bottom ones.

It beats me as to why is it this way. Let me know if you know the answer.

Back to work!