这只发生在我的iPhone上。每次我隐藏/显示一个元素时,它会给出不同的字体大小。只有当我在“全部显示”区域显示和隐藏一个元素时才会发生这种情况
<style>
.asdf_2{
font-size:12px;
}
</style>
<script>
function showhide(x){
if(document.getElementById(x).style.display == '')
{
document.getElementById(x).style.display = 'none';
}
else
{
document.getElementById(x).style.display = '';
}
}
</script>
<div class="content">
<div class="asdf_all" onClick="showhide('showme1');showhide('showme2');">Show All</div>
<div class="asdf">
<div class="asdf_1" onClick="showhide('showme1');">Show1</div>
<div class="asdf_2" id="showme1" style="display:none">asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf
</div>
</div>
<div class="asdf">
<div class="asdf_1" onClick="showhide('showme2');">Show2</div>
<div class="asdf_2" id="showme2" style="display:none">asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf
</div>
</div>
</div>
答案 0 :(得分:1)
“这只发生在我的iPhone上。”
见:
How to avoid iOS automatic font size adjustment?
body {
-webkit-text-size-adjust: 100%;
}