Use the overflow
, overflow-y
or overflow-x
style with a specific width
or height
.
If you just want to hide large content, use overflow:hidden
. If you want to also show the scroll bar, use overflow:scroll
.
Use overflow-x
to hide content that is wider than the width of the container. Use overflow-y
to hide content that is taller than the container. Use overflow
to hide content whose width and height exceed the width and height of the container.
<HTML> <BODY> <DIV STYLE="width:20ex; overflow-x:scroll; border:1px solid black;"> <NOBR>very long text very long text very long text very long text very long text</NOBR> </DIV> <BR /> <DIV STYLE="height:3em; overflow-y:scroll; border:1px solid black;"> line 1<BR /> line 2<BR /> line 3<BR /> line 4<BR /> line 5<BR /> line 6 </DIV> <BR /> <DIV STYLE="width:20ex; height:3em; overflow:scroll; border:1px solid black;"> <NOBR>very long text very long text very long text very long text very long text</NOBR> line 1<BR /> line 2<BR /> line 3<BR /> line 4<BR /> line 5<BR /> line 6 </DIV> <BR /> <DIV STYLE="width:20ex; height:3em; overflow:hidden; border:1px solid black;"> <NOBR>very long text very long text very long text very long text very long text</NOBR> line 1<BR /> line 2<BR /> line 3<BR /> line 4<BR /> line 5<BR /> line 6 </DIV> </BODY> </HTML>
source share