gpt4 book ai didi

javascript - 切换可见性时字体大小会发生变化

转载 作者:太空宇宙 更新时间:2023-11-04 15:24:53 25 4
gpt4 key购买 nike

这只发生在我的 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>

最佳答案

"This only happens on my iPhone."

看这个:

How to avoid iOS automatic font size adjustment?

body {
-webkit-text-size-adjust: 100%;
}

关于javascript - 切换可见性时字体大小会发生变化,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14165590/

25 4 0