Square div?

Why is the red div not more square?
I would really like a 1x1 pixel div

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<div id="container" style="width:200px;height:200px; border:1px solid green"></div>
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;   

Open in new window

LVL 75
Michel PlungjanIT ExpertAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Have you tried making a 1x1px transparent gif image and putting that inside the div?

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Michel PlungjanIT ExpertAuthor Commented:
Hmm, that works - but why?
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!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.