如何仅使固定位置 div 的一部分可见?
我创建了一个固定位置的 div,其宽度非常大,因此它可以在一行中水平包含大约 2 打公司徽标。就 html 而言,我只是创建了一个 ul,每个 li 都有一个徽标,然后将所有 li 浮动到左侧。我使用固定定位,这样浏览器就不会创建滚动条,现在我只需要 800px 的宽度在任何一个时间点都可见,并且在线上的徽标仅显示位于内部的部分800px区域。我该怎么做? (我现在正在尝试制作一个自定义轮播)
I created a fixed positioned div that has a very large width so that it can contain about 2 dozen company logos horizontally in a single line. As far as html goes, I just created a ul with one logo per li and then floated all of the li to the left. I used fixed positioning so the browser wouldn't create a scrollbar, and now I want only 800px in terms of width being visible at any one point in time, and logos that are on the line only being shown for the portion that is lying inside the 800px area. How do I do this? (I'm trying to make a custom carousel at the moment)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
将列表放入 div 中,将 div 宽度设置为所需的宽度,并按照 div 的样式将滚动设置为自动。
我认为应该这样做
Place the list into a div, set the div width to be what you want and set scrolling to auto in the style of the div.
i think that should do it
显式设置 Div 的高度和宽度,然后将其“overflow”css 属性设置为“scroll”或“auto”。
Explicitly set the height and width of the Div and then set it's "overflow" css property to "scroll" or "auto".