css 内容溢出显示垂直滚动条,内容不超出就不显示滚动条

搬运自:https://www.cnblogs.com/wangyuanyuanlovexuanxuan/p/7767767.html

html:

<style>
  .div1{
    width:200px;
    height:100px;
    overflow-y:auto;//关键
  }
</style>

<div class="div1">   内容 内容 内容 内容 内容 内容 内容 </div>

猜你喜欢

转载自www.cnblogs.com/linjiangxian/p/11721510.html