Click here to Skip to main content
15,892,298 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
How the set the width, height, margin-left, margin-top for a canvas in the following
code:
VB
// create canvas
    canvas = document.createElement('canvas'),
Posted

1 solution

Hi,

You can set attribute of an element using java script or jQuery as follow:

Javascrpt :
JavaScript
var canvas = document.createElement('canvas');

canvas.id = "canvas1";
canvas.width = 100;
canvas.height = 100;
canvas.style.border = "1px solid";
canvas.style.marginLeft = "10px";
canvas.style.marginTop = "10px";


Thank You
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900