Hi i am trying to have this:
<div>
<canvas height="300px" width="200px"></canvas>
</div>
I created javascript to render canvas, could someone advice how to stretch div according canvas size and if it is possible without javascript?? I already tried solutions for nested divs, but it didn't work. Thanks
Use a different
display
for the containingdiv
then things should work (see also this jsfiddle):CSS:
PS. The
line-height: 0
is there to make sure there appears no space is rendered below the canvas. See also this question.