Why is flex affecting font size on iOS?

五迷三道 提交于 2020-02-04 00:59:13

问题


I'm pretty shocked after confirming that font size is affected somehow while using flexbox on Safari iOS

iOS

Desktop

Code

a {
    font-size: 14px;
}

a + a {
    margin-left: 1em;
}

.flex {
    display: flex;
}

.float > a {
    float: left;
}

.float:after {
    content: "";
    display: block;
    clear: both;
}
<div>
    <a href="#">hola</a>
    <a href="#">adios</a>
    <a href="#">hola</a>
    <a href="#">adios</a>
    <a href="#">hola</a>
    <a href="#">adios</a>
    <a href="#">hola</a>
    <a href="#">adios</a>
</div>

<div class="flex">
    <a href="#">hola</a>
    <a href="#">adios</a>
    <a href="#">hola</a>
    <a href="#">adios</a>
    <a href="#">hola</a>
    <a href="#">adios</a>
    <a href="#">hola</a>
    <a href="#">adios</a>
</div>

<div class="float">
    <a href="#">hola</a>
    <a href="#">adios</a>
    <a href="#">hola</a>
    <a href="#">adios</a>
    <a href="#">hola</a>
    <a href="#">adios</a>
    <a href="#">hola</a>
    <a href="#">adios</a>
</div>

What am I missing here?, is this a bug?


回答1:


So, the issue with the font-size appears for both, flex and float:

https://stackoverflow.com/a/22417120/94144

Adding this fixed it:

a {
    text-size-adjust: 100%; 
    -ms-text-size-adjust: 100%; 
    -moz-text-size-adjust: 100%; 
    -webkit-text-size-adjust: 100%;
}


来源:https://stackoverflow.com/questions/38346494/why-is-flex-affecting-font-size-on-ios

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!