HTML,overflow:scroll和float [英] HTML, overflow:scroll, and float
问题描述
我有一个div,其中封装了许多无序列表(ul).我将每个ul设置为"float:left".而且我还将包含它们的父div设置为"overflow-x:scroll".发生的情况是,当ul碰到页面边缘并且不并排使用父div的scrolling属性(滚动条在其中)时,它们正在包装.为什么?我该如何解决?
I have a div that encapsulates many unordered lists (ul). I have each ul set to "float:left". And I also have the parent div that contains them set to "overflow-x:scroll". What's happening is the ul's are wrapping when they hit the edge of the page and not staying side by side to take advantage of the scrolling property of the parent div (the scroll bars are there). Why? How can I fix this?
感谢您的帮助.
推荐答案
您需要将这些uls插入另一个div中,您将获得width = [ul的宽度] * [uls的数量]
http://jsfiddle.net/seler/gAGKh/或计算uls的总宽度 http://jsfiddle.net/seler/gAGKh/1/
you need to insert those uls in another div, to which you'll give width=[width of ul]*[number of uls]
http://jsfiddle.net/seler/gAGKh/
or count total width of uls
http://jsfiddle.net/seler/gAGKh/1/
这篇关于HTML,overflow:scroll和float的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!