Chrome will increase the font size when zooming out

后端 未结 2 1365
[愿得一人]
[愿得一人] 2021-01-15 00:53

I have the following code :

CSS

#container{
    font-size: 0.625em;
}

#div1 {
    width: 200px;
    height: 200px;
    background-color: green;
}
         


        
2条回答
  •  清歌不尽
    2021-01-15 01:00

    The divs has different width.

    10em is not always equivalent to 100px

    try setting the same width (em or px)

    An em is equal to the current font-size, for instance, if the font-size of the document is 12pt, 1em is equal to 12pt

    One pixel is equal to one dot on the computer screen

    refer this page for documentation

    your updated fiddle here

    body {
                font-size: 0.625em;
            }
    
            #div1 {
                width: 200px;
                height: 200px;
                background-color: green;
            }
    
            #div2 {
                width: 200px;
                height: 200px;
                background-color: red;
            }
    

    update

    if it doesn't work try with this css property

    -webkit-text-size-adjust: none;
    

提交回复
热议问题