开发者

Limit text width

开发者 https://www.devze.com 2023-03-27 05:10 出处:网络
Long inputs in my site overflow out of the div and the allowed width. I read that it\'s because the browser will only insert line breaks if there are spaces.

Long inputs in my site overflow out of the div and the allowed width.

I read that it's because the browser will only insert line breaks if there are spaces.

Since my site is all about user-input, that could me开发者_高级运维ss up with things.

I wanted to know if there's a way to still limit the width even if the input has no spaces in it.


I recomend you to use overflow:auto instead, to your div. It may give you better result.


Make your div scrollable so all overflowing content doesn't break the layout but scrolls instead.

 <div style="overflow:scroll;">...</div>


Yea, word wrap breaks lines on word boundaries. If you don't have word boundaries, then that's going to be an issue.

So don't rely on word-wrap, but make your containers scrollable with overflow: scroll and friends in CSS.

0

精彩评论

暂无评论...
验证码 换一张
取 消