【问题标题】:diffrent font size between iphone and samsung galaxyiphone和三星galaxy字体大小不同
【发布时间】:2014-02-02 14:03:31
【问题描述】:

我尝试使用 PhoneGap 构建主视图。 主视图有一些包含图像和文本的按钮。 每个按钮都有以下语句:

<div  ng-repeat="module in Modules" ng-click="setPage(module)" class="button" style="background-color: #ffffff;
                                                                    height: 11%;
                                                                    width: 60%;
                                                                    margin-bottom: 3px;
                                                                    margin-top: 1.5%;
                                                                    opacity: 0.8;
                                                                    padding-right: 0px;
                                                                    padding-left: 0px;
                                                                    text-align: center;
                                                                    font-size: 1em;">
            <img class="imgMain"  ng-src={{module.IconUrl}}>
            <span class="spanMain">{{module.Name}}</span>
</div>

css:

.spanMain{
font-size: 1em;
position: absolute;
bottom: 0;
right: 0;left: 0;"}

.imgMain{
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 25%;
margin: auto;
max-width: 50%;
max-height: 50%;}

在 iPhone 上看起来不错,但是在 Galaxy 中, 中的模块名称(即文本)以较小的字体显示文本。 如果我将字体大小更改为更大的大小,在 iPhone 上它会显示得很大,真的不成比例,但在 Galaxy 上它还可以。我该如何解决?

非常感谢,

【问题讨论】:

  • 您使用的是自定义字体吗?尝试使用为在移动设备上使用而优化的字体。字体在不同平台上呈现的效果往往完全不同。
  • 我尝试使用以下值:中、大、1em、precents 你推荐什么?
  • 我想知道您使用的是什么字体系列。像“Arial”还是“Helvetica”?您也可以尝试使用 px 而不是 em。

标签: jquery html css angularjs cordova


【解决方案1】:

不知道这个解决方案是否有效,但我猜你可以这样做:

编辑:用你的值名制作我的解决方案

JavaScript:

$scope.device = "";
if ((navigator.userAgent.match(/iPhone/)) || (navigator.userAgent.match(/iPod/))) {
 $scope.device = "iphone";
}else if (navigator.userAgent.match(/Android/)) {
 $scope.device = "android"
}

HTML:

<span class="spanMain" title="{{device}}">{{module.Name}}</span>

CSS:

.spanMain{
 font-size: 1em;
 position: absolute;
 bottom: 0;
 right: 0;
 left: 0;
}

.spanMain[title=iphone]{
 font-size: 1em;
}

.spanMain[title=android]{
 font-size: 2em;
}

【讨论】:

  • 哦!那可能是因为分辨率!也许THIS 回答了你的问题?
  • 问题是目标密度 Dpi。我将其更改为中 dpi。我不喜欢这种解决方案,但这是目前最好的解决方案,谢谢。
猜你喜欢
  • 2015-07-15
  • 1970-01-01
  • 1970-01-01
  • 2015-08-03
  • 1970-01-01
  • 2013-10-17
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多