css - 固定盒子在 ipad 上跳转

标签 css ipad

我注意到使用 iPad 时我的网站出现了一些奇怪的行为。 我已将其缩小到固定位置自动 margin 。例如:

box{
    display:block;
    border:thin solid black;
    background:yellow;
    position:fixed;
    width:90%;
    height:50%;
    margin:auto auto;

    top:0;
    bottom: 0;
    left: 0;
    right: 0;
}
<box>
    <input/><br/>
    <input/><br/>
</box>

<div style="height:800%; background:blue;">
</div>

这在安卓和桌面上的 chrome 中 100% 正常,但在我的 iPad 上,在文本框之间切换会导致文本框看起来“跳跃”。这在视觉上非常分散注意力,在某些情况下会导致方 block 在屏幕下方生成。 这是一个容易修复的已知问题吗?

最佳答案

max-width 设置为可能导致跳转的输入,因为其中未指定宽度。

<style>
box{
    display:block;
    border:thin solid black;
    background:yellow;
    position:fixed;
    width:90%;
    height:50%;
    margin:auto auto;

    top:0;
    bottom: 0;
    left: 0;
    right: 0;
}
  input{
    max-width: calc(100% - 4px);
  }
</style>


<box>
    <input/><br/>
    <input/><br/>
</box>

<div style="height:800%; background:blue;">
</div>

关于css - 固定盒子在 ipad 上跳转,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40756331/

相关文章:

iphone - 如何根据html内容设置UIWebView的高度?

ios - 物理 iPad Pro 设备返回的语音合成语音是否与其模拟器不同?

iphone - prefix 属性后面必须跟一个接口(interface)或协议(protocol) + NSManagedObject 的子类

jquery - JQuery fadeIn() 上的 CSS3 转换不起作用

ios - 编辑时 UITextView 光标完全消失

html - 将 Div 中的背景图片变成链接

javascript - 反转 CSS3 变换矩阵

xcode - MKMapView 不会在 iOS6 的 iPad REAL DEVICE 上缩放和动画

javascript - 附加 2 jQuery "click events"只能工作一次

javascript - 使用 JQuery Range Slider 实时更新 CSS 值