<wbr>
在 Chrome 中,我可以使用和的组合指定我希望文本换行的位置white-space: nowrap;
。但在 Firefox 或 IE 中,文本只是开箱即用并被<wbr>
忽略。Chrome 是否正确解释了规范,或者这只是一个古怪的,如果有用的话,实现错误?是否有用于文本换行提示的跨浏览器解决方案?
.headline-container {
width: 50%;
border: 1px solid red;
}
h1 {
white-space: nowrap;
}
@media (max-width: 400px) {
h1 {
white-space: normal;
}
}
<div class="headline-container">
<h1>This headline could <wbr>wrap in the middle <wbr>but only on Chrome</h1>
</div>
这个答案有同样的问题——对我来说它在 Firefox 中不起作用。