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

 

<!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>

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




					


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM