div如何加滚动条

时间:2022-10-02 05:46:37

div如何加滚动条

<div style="position:absolute; height:400px; overflow:auto"></div>
div 设置滚动条显示:overflow :yes
div 设置滚动条自适应显示:overflow :auto
div 设置上下滚动条显示:overflow-y :yes
div 设置上下滚动条自适应显示:overflow-y :auto
如果该div被包含在其他对象例如td中,则位置可设为相对:position:relative

div如何加滚动条

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<style type="text/css">
.pic{
width: 300px;
height: 300px;
overflow: auto;

}
.pic img{
width: 500px;
height: 500px;
}
</style>
</head>
<body>
<div class="pic">
<img src="img/60.jpg"/>
</div>
</body>
</html>

下面是我的公众号,大家可以关注一下,可以一起学习,一起进步:

div如何加滚动条