When trying to add a new element on the screen, I am facing an issue with the absolute positioning not working properly.
Sample Code in Javascript
function drawElement(e,name){
$("#canvas").append("<div id='" + name + "' class='element'"
+ "left="+e.pageX+" top=" + e.pageY +">"
+ name
+"</div>");
}
Related CSS Style
.element{
display:inline-block;
background:blue;
position:absolute;
}
Any idea what might be causing this issue?
- List item