1

看看 Firefox 和 Chrome 中的这个 JS fiddle

https://jsfiddle.net/rdsz2thp/

在 webkit'word-break: break-word'上的 aninput['text']将使文字在内部换行。Firefox 不支持这一点,但有没有办法获得这种行为?

示例代码:

.wrappy {
    word-break: break-word;
    width: 100%;
    height: 58px;
}

.wrapper {
    width: 200px;
}

<div class='wrapper'>
    <input type='text' class='wrappy' value="fsdf asdf asdfsadfasdf sdf sdfasd fsdas dfsadf asdf sadfasfd asdf sdf asdf sdfasdf asdf asd fsadfasfd ">
</div>
4

2 回答 2

0

<input>是单行,<textarea>是多行。所以<textarea>改用

HTML

<div class='wrapper'>
    <textarea class='wrappy'>fsdf asdf asdfsadfasdf sdf sdfasd fsdas dfsadf asdf sadfasfd asdf sdf asdf sdfasdf asdf asd fsadfasfd</textarea>
</div>

在这里演示

于 2015-11-10T16:39:22.000 回答
0

请改用 textarea,请参见此处

<div class='wrapper'>
    <textarea class='wrappy'>fsdf asdf asdfsadfasdf sdf sdfasd fsdas dfsadf asdf sadfasfd asdf sdf asdf sdfasdf asdf asd fsadfasfd</textarea>
</div>
于 2015-11-10T16:49:24.433 回答