如果我做:
<div style="width: 200px; height: 200px; background-color: yellow; font-size: xx-large;">
Hello 1<br>
Hello 2<br>
Hello 3<br>
Hello 4<br>
Hello 5<br>
Hello 6<br>
Hello 7<be>
</div>
文本从DIV中渗出。我希望它切断文本的显示或放置滚动条。除了文本外,什么都没有退出DIV!我了解这基本上是这样<textarea>
做的,但是出于其他原因,我试图不使用该标签。
一定要感谢您的帮助!
谢谢!
您可以利用overflow-y
到强制的滚动条y轴。
产生:
<div style="overflow-y:auto;width: 200px; height: 200px; background-color: yellow; font-size: xx-large;">
Hello 1<br>
Hello 2<br>
Hello 3<br>
Hello 4<br>
Hello 5<br>
Hello 6<br>
Hello 7<be>
</div>
如果要剪切多余的文本,可以使用overflow:hidden
来隐藏超出宽度和高度的文本。
<div style="width: 200px; overflow:hidden;height: 200px; background-color: yellow; font-size: xx-large;">
Hello 1<br>
Hello 2<br>
Hello 3<br>
Hello 4<br>
Hello 5<br>
Hello 6<br>
Hello 7<be>
</div>
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句