Michel Plungjan
asked on
Square div?
Why is the red div not more square?
I would really like a 1x1 pixel div
Thanks
I would really like a 1x1 pixel div
Thanks
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title></title>
</head>
<body>
<div id="container" style="width:200px;height:200px; border:1px solid green"></div>
<script>
var newDiv = document.createElement('DIV');
newDiv.style.position = 'absolute';
newDiv.style.width = '3px';
newDiv.style.height = '3px';
newDiv.style.left = '50px';
newDiv.style.top = '50px';
newDiv.style.border = "1px solid red";
newDiv.style.zIndex = 100;
document.getElementById('container').appendChild(newDiv)
</script>
</body>
</html>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Because otherwise the browser classes nothing as text, and as the text size will be bigger than 1px, so is the DIV, as is my understanding. The transparent GIF is your friend!
ASKER