html - iOS 设备上的 100% 高度不起作用

标签 html ios css height

我在 html 中画一条垂直线是这样的:

.vr-long {
  background: #000000;
  border: none;
  width: 1px;
  height: 100%;
}
<hr class="vr-long">

除了我的 ipad 上的所有浏览器(iphone 未测试)外,这在所有设备(PC、Android)和所有经过测试的浏览器上都运行良好。在我的 ipad 上,所有垂直线都消失了。问题似乎是“高度:100%;”因为当我使用 height: 50px; 时,我得到了那条垂直线。

关于如何让 height: 100% 在 iOS 上工作有什么想法吗?

顺便说一句:当我使用 img-tag 通过使用 repeat-y 和高度来绘制垂直线时出现同样的问题:100% ...

最佳答案

我通过使用 div 作为垂直 lign 解决了这个问题。

.vr-long {
  margin: 0 2em 0 2em;
  border: 1px solid #000000;
}
<div class="vr-long"></div>

我仍然不知道为什么这个问题只出现在我的 ipad 上,但是那个 workaorund 没有引起任何问题。

关于html - iOS 设备上的 100% 高度不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39924217/

相关文章:

html - 我怎样才能在 HTML/CSS 中做到这一点

java - 移动应用业务逻辑层策略

ios - iOS SDK 中带有 mov、3gp 和 mp4 的 RTSP 播放扩展

css - Bootstrap : Remove animation from transition. js

javascript - 如何使用css制作曲线边框

html - 点击 Angular Material's Card 内的按钮会触发卡片本身的点击事件

html - 容器 Bootstrap 中的全宽

CSS 将鼠标悬停在其他 2 个图像上时显示图像

html - 边框在手机上看起来很近

ios - 设置no storyboard后不调用viewDidLoad