When calling the function below, I attempt to include a div block but struggle with setting the left position. The alert function displays a message of '600px', however, the block appears in a different position on my screen.
function show(){
if(document.getElementById('div1') == null){
var div1 = document.createElement('div');
div1.style.left = '600px';
document.body.appendChild(div1);
alert(div1.style.left);
}
}
This is my first question here, so I am not sure how to format code properly.