当iPhone方向从纵向更改为横向时,保留HTML字体大小 [英] Preserve HTML font-size when iPhone orientation changes from portrait to landscape
问题描述
我有一个移动网络应用程序,其中包含多个listitem,每个li中都有一个超链接:
I have a mobile web application with an unordered list containing multiple listitems with a hyperlink inside of each li:
...我的问题是如何格式化超链接,以便它们在iPhone上查看时不会更改大小,而accellerometer从纵向 - >横向切换?现在,我有超链接字体大小指定为14像素,但当切换到横向时,它吹到像20像素。我想要的字体大小保持不变。下面是代码:
...My question is how can I format the hyperlinks so that they DON'T change size when viewed on an iPhone, and the accellerometer switches from portrait -> landscape? Right now, I have the hyperlink font size spec'ed to 14px, but when switching to landscape, it blows way up to like 20px. I want the font-size to stay the same. Here is the code:
ul li a
{
font-size:14px;
text-decoration: none;
color: #cc9999;
}
<ul>
<li id="home" class="active">
<a href="home.html">HOME</a>
</li>
<li id="home" class="active">
<a href="test.html">TEST</a>
</li>
</ul>
推荐答案
您可以通过 -webkit-text-size-adjust
CSS属性禁用此行为:
You can disable this behavior through the -webkit-text-size-adjust
CSS property:
html {
-webkit-text-size-adjust: 100%; /* Prevent font scaling in landscape while allowing user zoom */
}
此属性将在 Safari Web内容指南。
这篇关于当iPhone方向从纵向更改为横向时,保留HTML字体大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!