使用CSS使div可垂直滚动

本文翻译自:Making a div vertically scrollable using CSS

This 这个

 <div id="" style="overflow:scroll; height:400px;"> 

gives a div that the user can scroll in both in horizontally and vertically. 给出一个div ,用户可以在水平和垂直方向上滚动。 How do I change it so that the div is only scrollable vertically? 如何更改它以使div 只能垂直滚动?


#1楼

参考:https://stackoom.com/question/ejKv/使用CSS使div可垂直滚动


#2楼

You can use this code instead. 您可以使用此代码。

<div id="" style="overflow-y:scroll; overflow-x:hidden; height:400px;">


overflow-x : The overflow-x property specifies what to do with the left/right edges of the content - if it overflows the element's content area. overflow-x :overflow-x属性指定如何处理内容的左/右边缘 - 如果它溢出元素的内容区域。
overflow-y : The overflow-y property specifies what to do with the top/bottom edges of the content - if it overflows the element's content area. overflow-y

  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值