Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is the border width not the same as what I set in html?

I set a border style of a div element in html as border: 1px solid black;. It shows correctly in most cases. But I just found a weird one, which is Chrome on Win 7 Home Premium, that the computed style shows the border width is 1.11111111px instead of 1px. Could someone tell me any possible reason that makes this happen?

like image 998
chaonextdoor Avatar asked Dec 12 '12 00:12

chaonextdoor


3 Answers

i am not sure and just have couple guesses:

  1. Is that possible your style is overwritten by other style in the same css file?

  2. Is your browser in 100% zoom? I don't think this will bother but I suggest you check it

like image 119
Oscar Zhang Avatar answered Nov 07 '22 21:11

Oscar Zhang


@chaonextdoor Did you use 'reset.css' in your project? Because most of the time if we do not specify any styles for any element, them browser uses its default settings on those places.

like image 25
V15HM4Y Avatar answered Nov 07 '22 20:11

V15HM4Y


Quick question: Is there a specific reason your border has to be exactly 1px.

Also, as everyone else is saying, try to set your browser and your computer zoom at the default 100% zoom.

And the code: border: 1px solid black; is correct

like image 1
Harrison Howard Avatar answered Nov 07 '22 22:11

Harrison Howard