我这里有一些代码将div分成六等分。
在桌面浏览器上,这似乎工作正常。在iOS上的safrai / chrome上,它没有。
您可以在此处查看
在我的桌面浏览器上,每个div的高度为50px并填充容器。 在移动浏览器上,每个div的高度为49px,并在包装器的底部留下一个空格(你可以在上面的小提琴上看到这一点。
任何想法为什么?
<div class="fretboardWrapper">
<div class="strings">
<div class="string" id="one"></div>
<div class="string" id="two"></div>
<div class="string" id="three"></div>
<div class="string" id="four"></div>
<div class="string" id="five"></div>
<div class="string" id="six"></div>
</div>
</div>
body{
color:white;
}
#one, #three, #five {
background:blue;
}
#two, #four, #six {
background:green;
}
.strings {
height:100%;
width:100%;
position:relative;
}
.string {
z-index:2;
height:16.666%;
}
.fretboardWrapper {
position:relative;
width:100%;
height:300px;
background-color:red;
}
<script>
$('#one').text($('#one').height());
$('#two').text($('#two').height());
$('#three').text($('#three').height());
$('#four').text($('#four').height());
$('#five').text($('#five').height());
$('#six').text($('#six').height());
</script>
修改
有趣的是,分成5个作品ok http://jsfiddle.net/LZxxB/33/
在safrai mobile中使用百分比时是否有小数位限制?