在Chrome 67.0(苹果机)中,当在readonly
元素上指定disabled
或textarea
属性时,渲染时似乎会去除换行符。删除属性可以正确格式化内容。
例如,没有readonly
或disabled
:
textarea {
height: 100px;
resize: none;
width: 100%;
white-space: nowrap;
}
<textarea id="textarea-badge1"><div class="_wv_widget">
<a href="https://www.google.com" title="This is a link">
<img src="" alt="" title="" />
</a>
</div></textarea>
使用readonly
:
textarea {
height: 100px;
resize: none;
width: 100%;
white-space: nowrap;
}
<textarea readonly id="textarea-badge1"><div class="_wv_widget">
<a href="https://www.google.com" title="This is a link">
<img src="" alt="" title="" />
</a>
</div></textarea>
使用disabled
:
textarea {
height: 100px;
resize: none;
width: 100%;
white-space: nowrap;
}
<textarea disabled id="textarea-badge1"><div class="_wv_widget">
<a href="https://www.google.com" title="This is a link">
<img src="" alt="" title="" />
</a>
</div></textarea>
有解决方案吗?使用\ t无效。
答案 0 :(得分:1)
您可以将white-space: nowrap;
更改为white-space: pre-wrap;
吗?这似乎对我有用。
答案 1 :(得分:1)
设置develop
将产生所需的结果。