I have the following code :
CSS
#container{
font-size: 0.625em;
}
#div1 {
width: 200px;
height: 200px;
background-color: green;
}
#div2 {
width: 20em;
height: 20em;
background-color: red;
}
HTML
<div id="container">
<div id="div1">
This is a test message.This is a test message.This is a test message.This is a test message.
</div>
<div id="div2">
This is a test message.This is a test message.This is a test message.This is a test message.
</div>
</div>
Chrome Version
Version 35.0.1916.153 m
When you zoom to 50% or smaller in Chrome, the size of the two divs will become different. If your check the font-size in dev tool, your will realize that Chrome automatically increased the font-size of the document.
Can anybody tell me why this happens? And how could I prevent it?
I am doing some research on the difference of em and px, so change the width of #div2 to 200px is not acceptable.
Updated the content and source.
Thank you for your help.
Updated June 16th, 2014
Found something interesting and wanna share with you guys here.
If you had ever touched the "Advanced font settings" in Chrome, or using an default version(not Chinese or Japanese):
you will never be allowed to set font-size to some number smaller than 6px(in Chinese or Japanese version it will be 12px).
1em will never go smaller than 6px(12px), when you measure something like "height" with "em".
if you set a text to 6px, and zoom to 50%, you may expect to see the text rendered like 3px(become to half). But the text will be set to 12px by chrome, and may break your layout.
Thanks to Dawar Husain. He helps me realize the minimum font size thing.