离子 - 如何设置<离子滚动>高度,以便它在所有分辨率设备中自动调整? [英] Ionic - How to set <Ion-scroll> height so that it automatically adjusts in all resolution devices?
问题描述
我的代码如下:
<ion-scroll style="height:200px;">
<ion-item ng-repeat="items in Items" >
<!--repeat group-->
</ion-item>
</ion-scroll>
我有一个高度= 200px的滚动视图,这在小型设备上看起来不错,但是当我查看时这在大型设备上,内容看起来太小,因为高度是'200px',这是相对较小的。那么,解决这个问题的正确方法是什么?我尝试使用高度百分比,但它没有修复。请帮助和抱歉我的英语不好。
I have a scroll view of height = 200px, this looks ok on small devices, but when I view this on large device, the content appears too small because the height is '200px' which is comparatively small. So, what's the proper method of fixing this? I tried using height in percentages but it did not fix. Please, help and sorry for my bad English.
推荐答案
使用 vh
单位而不是 px
。您可以将 vh
值设置为1到100,100 vh表示全屏大小。您的代码将是:
Use vh
unit instead of px
.You can set vh
value from 1 to 100, 100 vh means full screen size. Your code will be:
<ion-scroll style="height:100vh;">
或者如果 height
不起作用
<ion-scroll style="max-height:100vh;">
有用链接关于样式与 vh
。
这篇关于离子 - 如何设置<离子滚动>高度,以便它在所有分辨率设备中自动调整?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!