html in div add scroll bars

div are two ways to add scroll bars:

One,

<div style=" overflow:scroll; width:400px; height:400px;”></div>


Remember the width and height must be set Oh, otherwise it fails
but when not exceeded, there will be the following scroll bar, so it is not the best option
two,

<div style=" overflow-y:auto; overflow-x:auto; width:400px; height:400px;”></div>


Remember the width and height must be set Oh, otherwise it's not

so good is that when the width and height does not exceed, just a line

Stating

designated directly div overflow property to auto you can, but you must specify the height of the div ,as follows:

<div style="position:absolute; height:400px; overflow:auto">

</div>


To scroll horizontally, then: overflow-x: auto

Similarly, the vertical scroll bar as: overflow-y: auto

If div is included in the other objects in the td e.g., the relative position can be set: position: relative

Guess you like

Origin www.cnblogs.com/yanl55555/p/12543994.html
Recommended