Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HTML, overflow:scroll, and float

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?

Thanks for any help.

like image 400
s2cuts Avatar asked May 08 '11 06:05

s2cuts


People also ask

How do I float a div inside a div?

Use CSS property to set the height and width of div and use display property to place div in side-by-side format. float:left; This property is used for those elements(div) that will float on left side. float:right; This property is used for those elements(div) that will float on right side.

How do you clip the overflowing content from an HTML element?

Use overflow-x : hidden and overflow-y : scroll , or overflow: hidden scroll instead. Use overflow: clip instead. As of Firefox 63, -moz-scrollbars-none , -moz-scrollbars-horizontal , and -moz-scrollbars-vertical are behind a feature preference setting.

How do I make my div overflow scroll?

Making a div vertically scrollable is easy by using CSS overflow property. There are different values in overflow property. For example: overflow:auto; and the axis hiding procedure like overflow-x:hidden; and overflow-y:auto;.

How do I limit scrolling in HTML?

body has a margin by default in different browsers, generally it is around 8px, so you can remove it by using margin: 0 . Your main css property should always come after your vendor prefixes such as -webkit- , -moz- , etc.


1 Answers

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/

like image 169
seler Avatar answered Sep 18 '22 17:09

seler