我在iOS Safari浏览器(不是Safari桌面版,也不是Chrome桌面版和Chrome移动版)上遇到了一个非常奇怪的问题。
我有一些可以被用户拖动的div元素。当用户进行"预览"时,在iOS Safari移动版中,文本会出现"包装"(wrapper),因为它没有足够的空间来呈现它,就像这样:
Lorem Ipsum Text
Lorem Ipsum <- 由于边框导致的换行问题,没有足够的空间。
Text
这些div元素:
<div class="text-perfect-correction" style="opacity: 1; font-family: Lato; left: 594px; top: 386px; font-size: 50px; color: rgb(0, 0, 0); width: 472px; height: 103px; position: absolute; display: block;">
<div style="display:inherit;" class="text-div" spellcheck="false">
<p>
<span style="color:#696969"><strong>Lorem ipsum text</strong></span>
</p>
</div>
</div>
这些 CSS 类的写法如下:
.text-perfect-correction {
border-width: 6px;
border-color: transparent;
border-style: dotted;
padding: 5px;
margin: -11px;
}
.text-div {
-webkit-line-break: after-white-space;
display: inline;
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
-o-user-select: none;
user-select: none;
}
我使用 perfect-correction-class,因为当您点击 div 时,我会显示一些按钮,并显示一个 border 来向用户展示哪个 div 被选择。
在其他所有浏览器中,我都能正确地看到:
Lorem impsum text Lorem impsum text <- 没有换行
这方面有任何问题吗?
谢谢!