I am trying to have boxes that float/stack themselves off to the right as long as there is room. I came pretty close to what I want, but the DIVs keep getting wrapped over, so that the items lose their heading.
.box{
height: additive;
width: 222px;
margin: 8px;
background-color: #fff;
border-radius: 3px;
padding: 10px;
font-size: 14px;
box-shadow: 4px 4px #666;
word-break: keep-all;
}
body {
padding: 20px;
font-family: Helvetica;
background-color: #20262e;
-webkit-column-width: 202px;
-moz-column-width: 202px;
-column-width: 202px;
-ms-column-width: 202px;
column-width: 202px;
}
<html>
<head>
</head>
<body>
<div class="box">
<h3>
eins
</h3>1
<br/>2
<br/>3
<br/>4
<br/>5
<br/>6
<br/>7
<br/>8
<br/>9
<br/>10
<br/>11
<br/>12
<br/>13
<br/>14
<br/>15
<br/>16
<br/>17
<br/>18
<br/>19
<br/>20
<br/>
</div>
<div class="box">
<h3>
zwei
</h3>1
<br/>2
<br/>3
<br/>4
<br/>
</div>
<div class="box">
<h3>
drei
</h3>1
<br/>2
<br/>3
<br/>4
<br/>5
<br/>6
<br/>7
<br/>8
<br/>9
<br/>
</div>
<div class="box">
<h3>
vier
</h3>1
<br/>2
<br/>3
<br/>4
<br/>
</div>
<div class="box">
<h3>
fünf
</h3>1
<br/>2
<br/>3
<br/>4
<br/>5
<br/>6
<br/>7
<br/>8
<br/>9
<br/>10
<br/>11
<br/>12
<br/>13
<br/>14
<br/>15
<br/>16
<br/>17
<br/>18
<br/>19
<br/>20
<br/>
</div>
<div class="box">
<h3>
sechs
</h3>1
<br/>2
<br/>3
<br/>4
<br/>5
<br/>6
<br/>7
<br/>8
<br/>9
<br/>10
<br/>11
<br/>12
<br/>
</div>
<div class="box">
<h3>
sieben
</h3>1
<br/>2
<br/>3
<br/>4
<br/>5
<br/>6
<br/>
</div>
<div class="box">
<h3>
acht
</h3>1
<br/>2
<br/>3
<br/>4
<br/>5
<br/>
</div>
<div class="box">
<h3>
neun
</h3>1
<br/>2
<br/>3
<br/>4
<br/>5
<br/>6
<br/>7
<br/>8
<br/>9
<br/>10
<br/>11
<br/>12
<br/>13
<br/>14
<br/>15
<br/>16
<br/>17
<br/>
</div>
</body>
</html>
Here is a fiddle: https://jsfiddle.net/Omphaloskopie/py1hrpvs/
As you can see the boxes wrap very ugly. How can I prevent that?
Edit:
To clarify what I am looking for: I am trying to not have grid, but boxes tightly wrapped around the content. The boxes should not be divided / wrap at all. Boxes should align themselves preferably to the right to fill up the page, but if single boxes are to tall vertical scrolling would be okay. Where there is enough vertical space, more smaller boxes should align on top of each other. The page would not have a straight bottom line, the bottom would look like left-aligned text flipped by 90°.
Basically it should look like this for example: http://www.ballajack.com/wp-content/uploads/2012/01/bookolio-e1327663255869.jpg (this look is achieved by premeditating box-sizes and absolute positioning. I am trying to avoid that. There has to be an easier way.)
are stand-ins for links. one per visible line. the boxes are not equally sized. – Omphaloskopie Sep 18 '18 at 02:21