Css IE和Chrome中分数像素的舍入方式不同
有没有办法控制浏览器是向上还是向下舍入分数像素?IE默认向下取整,Chrome向上取整,如下面的示例所示 我的HTML:Css IE和Chrome中分数像素的舍入方式不同,css,internet-explorer,google-chrome,element,percentage,Css,Internet Explorer,Google Chrome,Element,Percentage,有没有办法控制浏览器是向上还是向下舍入分数像素?IE默认向下取整,Chrome向上取整,如下面的示例所示 我的HTML: <div id="percentage"> <div class="first">50%=100px</div> <div class="second">50.5%=101px</div> <div class="third">51%=102px</div> </
<div id="percentage">
<div class="first">50%=100px</div>
<div class="second">50.5%=101px</div>
<div class="third">51%=102px</div>
</div>
<br />
<div id="pixels">
<div class="first">50px</div>
<div class="second">50.5px</div>
<div class="third">50.6px</div>
<div class="fourth">51px</div>
</div>
不能更改浏览器舍入分数像素的方式。这是不同浏览器呈现HTML方式的内在差异之一 不可避免的问题是:为什么需要十进制像素?同意@Aioros。分数像素总是一个坏主意。我不是手动设置这些。。。在我的网格系统上。。。我只是放了6个可乐。。。或者8个科伦。。。它有这些%和很多小数…@BFDatabaseAdmin没有回答这个问题。
#percentage {
width: 200px;
color: white;
}
#percentage .first {
width: 50%;
height: 20px;
background-color: red;
}
#percentage .second {
width: 50.5%;
height: 20px;
background-color:green;
}
#percentage .third {
width: 51%;
height: 20px;
background-color:blue;
}
#pixels {
color: white;
}
#pixels .first {
width: 50px;
height: 20px;
background-color: red;
}
#pixels .second {
width: 50.5px;
height: 20px;
background-color:green;
}
#pixels .third {
width: 50.6px;
height: 20px;
background-color:blue;
}
#pixels .fourth {
width: 51px;
height: 20px;
background-color:red;
}