html - Elements in two columns with scrollbar -


I want to visualize a set of elements in two columns. When the number of elements is more than the space available, I would like to see a vertical scroll-bar.

HTML here:

  & lt; Div class = "container" & gt; & Lt; Div class = "box" & gt; Box 1 & lt; / Div & gt; & Lt; Div class = "box" & gt; Box 2 & lt; / Div & gt; & Lt; Div class = "box" & gt; Box 3 & lt; / Div & gt; & Lt; Div class = "box" & gt; Box 4 & lt; / Div & gt; & Lt; Div class = "box" & gt; Box 5 & lt; / Div & gt; & Lt; Div class = "box" & gt; Box 6 & lt; / Div & gt; & Lt; Div class = "box" & gt; Box 7 & lt; / Div & gt; & Lt; Div class = "box" & gt; Box 8 & lt; / Div & gt; & Lt; Div class = "box" & gt; Box 9 & lt; / Div & gt; & Lt; Div class = "box" & gt; Box 10 & lt; / Div & gt; & Lt; Div class = "box" & gt; Box 11 & lt; / Div & gt; & Lt; Div class = "box" & gt; Box 12 & lt; / Div & gt; & Lt; / Div & gt;  

CSS here:

 . Container (range: 1px solid red; height: 100 pixel; -webkit-column-count: 2; / * Chrome, Safari, Opera * / -moz-column-count: 2; / * Firefox * / column-count: 2 ;} .Box {Border: 1px solid blue; width: 100px;}  

JSFiddle.

Rendering is fine when elements are 10 or less

When the element is remaining more than 10, it is sung outside the container on the right, instead I would like to see a vertical scroll-bar for the container and 1-6 in 7-12 in columns 1-6 J.

What is such a distribution possible?

You can set a maximum-height and then add a overflow-scroll arrow to allow the container to scroll overflow-x: hidden < / Code> to remove vertical scrollbar.

example

 . Container {border: 1px solid red; Max-height: 100px; overflow-y: scr Scroll; Overflow-X: Hidden; }  

Comments

Popular posts from this blog

java - Can't add JTree to JPanel of a JInternalFrame -

javascript - data.match(var) not working it seems -

javascript - How can I pause a jQuery .each() loop, while waiting for user input? -