我有我正在测试的这个 HTML:
<div>
<div style="width: 940px; background-color: red;">
<div style="width: 50%; background-color: green;">
<div>Sick of spending endless time waiting on your computer?</div>
</div>
</div>
</div>
这在台式机或 iPhone 上运行良好。
但是当我像这样简单地添加另一个 div 时:
<div>
<div style="width: 940px; background-color: red;">
<div style="width: 50%; background-color: green;">
<div>Sick of spending endless time waiting on your computer?</div>
</div>
<div style="width: 50%; background-color: orange;">
<div>Sick of spending endless time waiting on your computer?</div>
</div>
</div>
</div>
50% div 中的文本在 iPhone 上开始换行。我在 iPhone 上的 Safari 和 Chrome 中对其进行了测试。
我很困惑为什么添加另一个 div 会在它们具有相同宽度时导致这种情况。
任何帮助都会很棒。
谢谢!
最佳答案
这是我自己想出来的。我的页面正在从主题辊加载 jQuery UI 样式表。该样式表中的某些内容导致了此问题。当我删除该样式表时,一切正常。
关于html - iPhone 上的 Div 宽度和问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19385800/