I need to change the order of elements using css in mobile view. Please refer to the code below.
<div class="container">
<aside>
<h2>Heading</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam pulvinar sapien a erat lacinia, in consequat metus tincidunt. Morbi rhoncus, odio ac im</p>
Link
</aside>
<span>This line should come after heading.</span>
</div>
I want to move the span right after the heading in mobile view.
This is how I want in mobile devices:
.container {
display: inline-block;
width: 100%;
}
aside {
width: 50%;
display: inline-block;
}
span {
width: 50%;
float: right;
margin-top: 30px;
}
<div class="container">
<aside>
<h2>Heading</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam pulvinar sapien a erat lacinia, in consequat metus tincidunt. Morbi rhoncus, odio ac im</p>
Link
</aside>
<span>This line should come after heading.</span>
</div>
Try this by switching classes using media queries
#media screen and (max-width: 600px) {
.show-mob {
display: block;
}
.show {
display: none;
}
}
<div class="container">
<aside>
<h2>Heading</h2>
<span class="show-mob">This line should come after heading.</span>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam pulvinar sapien a erat lacinia, in consequat metus tincidunt. Morbi rhoncus, odio ac im</p>
Link
</aside>
<span class="show">This line should come after heading.</span>
</div>
You can do like this.
<div class="container">
<aside>
<h2>Heading</h2>
<span id="spn1" style="display:none">This line should come after heading.</span>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam pulvinar
sapien a erat lacinia, in consequat metus tincidunt. Morbi rhoncus, odio ac
im</p>
Link
</aside>
<span id="spn2">This line should come after heading.</span>
</div>
For mobile view use media query
#media screen and (max-width: 600px) {
#spn1{
display:block;
}
#spn2{
display:none;
}
}
Its not possible to change it only with CSS
If you can use jquery you can try to use the .append() function and something like that
function checkPosition() {
if (window.matchMedia('(max-width: 767px)').matches) {
//...
} else {
//...
}
});
if you dont have the chance to use jQuery you need to restructure your HTML
You can do this:
<div class="container">
<aside>
<h2>Heading</h2>
<span class="show-on-mobile">This line should come after heading.</span>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam pulvinar sapien a erat lacinia, in consequat metus tincidunt. Morbi rhoncus, odio ac im</p>
Link
</aside>
<span class="hide-on-mobile">This line should come after heading.</span>
</div>
and for CSS:
.container {
display: inline-block;
width: 100%;
}
aside {
width: 50%;
display: inline-block;
}
span {
width: 50%;
float: right;
margin-top: 30px;
}
.show-on-mobile {
display:none;
}
#media (max-width: 575px) {
.hide-on-mobile {
display:none;
}
.show-on-mobile {
display:block;
float:none;
width:100%;
margin-bottomn:30px
}
}
EXAMPLE
#media only screen and (max-width: 768px) {
.container {
display: inline-block;
width: 100%;
}
aside {
width: 100%;
display: inline-block;
}
.container h2{position:relative; margin-bottom:20px;}
.container p{padding-top:30px;}
span {
width: 100%;
position:absolute;
left:0;
top:60px;
padding:10px;
}
}
<div class="container">
<aside>
<h2>Heading</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam pulvinar sapien a erat lacinia, in consequat metus tincidunt. Morbi rhoncus, odio ac im</p>
Link
</aside>
<span>This line should come after heading.</span>
</div>
Please try like this
Related
I'm trying to code this hero treatment.
The title and paragraph text is contained to a grid that has a max-width of 1200px and auto left and right margins.
The top and bottom borders should come from the left edge, but stop at the end of the centered 1200px text box.
I've coded them as HRs thinking that may be more helpful to style.
<div class="hero">
<img src="https://via.placeholder.com/1600x800" alt="">
<div class="hero-text">
<hr>
<div class="contain-to-grid">
<h1>Title</h1>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut eget laoreet dolor. Etiam quis leo venenatis, suscipit nisi id, luctus urna. Aenean iaculis justo vel consectetur mollis. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut eget laoreet dolor. Etiam quis leo venenatis, suscipit nisi id, luctus urna. Aenean iaculis justo vel consectetur mollis.</p>
</div>
<hr>
</div>
</div>
and here's my CSS (this is currently just making the HRs go full-width)
.hero {position: relative;}
.hero img {width: 100%; height: auto;}
.hero-text {position: absolute; bottom: 30px; width: 100%;}
.hero-text hr {border-color: #000; margin: 30px 0;}
.contain-to-grid {width: 100%; max-width: 1200px; margin: 0 auto;}
I'm stumped. Any ideas on how to code this? It does need to be responsive.
Just added '.inner' div and added css. Hope this help you.
.hero {
position: relative;
}
.hero img {
width: 100%;
height: auto;
}
.hero-text {
position: absolute;
bottom: 30px;
width: 100%;
}
.hero-text hr {
border-color: #000;
margin: 30px 0;
}
.contain-to-grid {
width: 100%;
max-width: 1200px;
margin: 0 auto;
}
.inner {
float: left;
width: 100%;
border-top: 2px solid #000;
border-bottom: 2px solid #000;
}
<div class="hero">
<img src="https://via.placeholder.com/1600x800" alt="">
<div class="hero-text">
<div class="contain-to-grid">
<div class="inner">
<h1>Title</h1>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut eget laoreet dolor. Etiam quis leo venenatis, suscipit nisi id, luctus urna. Aenean iaculis justo vel consectetur mollis. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut eget
laoreet dolor. Etiam quis leo venenatis, suscipit nisi id, luctus urna. Aenean iaculis justo vel consectetur mollis.</p>
</div>
</div>
</div>
</div>
I am struggling with the setting three responsive columns in a row using Bootstrap 4.
.buttons {
border: 1px solid #e86225;
color: #e86225 !important;
padding: 10px 20px;
font-size: 14px;
}
.buttons:hover {
border: 1px solid #ffffff;
background-color: #e86225;
color: #ffffff !important;
transition: background-color 1s, border 1s, color 1s;
}
.container-custom {
padding-top: 80px;
padding-bottom: 80px;
}
.custom-link {
padding: 15px 0;
}
.container p {
margin: 25px 0;
max-width: 400px;
}
#media(max-width: 767px){
.container-custom {
padding-top: 50px;
padding-bottom: 50px;
}
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/css/bootstrap.min.css" integrity="sha384-GJzZqFGwb1QTTN6wy59ffF1BuGJpLSa9DkKMp0DgiMDm4iYMj70gZWKYbI706tWS" crossorigin="anonymous">
<div class="container">
<div class="row container-custom justify-content-center">
<h2>Blog</h2>
<div class='d-flex flex-wrap pt-5'>
<div class="col-sm-12 col-md-4">
<img src="https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcSHBMzMRL0g3ELio_DdCRvdajdF812AQPP2AbmM_jYr_66CnwgS" alt="">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque nibh sem, ultricies sit amet tellus ut, iaculis interdum ante. Quisque at nibh ac diam faucibus congue.
</p>
<div class="custom-link">
Read more >
</div>
</div>
<div class="col-sm-12 col-md-4">
<img src="https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQh3Afn3A1FKb24tpO6eAdqr8hCdnafjqwCNqgjdSAWK1igoWfk" alt="">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque nibh sem, ultricies sit amet tellus ut, iaculis interdum ante. Quisque at nibh ac diam faucibus congue.
</p>
<div class="custom-link">
Read more >
</div>
</div>
<div class="col-sm-12 col-md-4">
<img src="https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQFsb6TxovKdTNx-8gdo1R01nZXxRRauett2KQ_ci76VgjK2hR7" alt="">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque nibh sem, ultricies sit amet tellus ut, iaculis interdum ante. Quisque at nibh ac diam faucibus congue.
</p>
<div class="custom-link">
Read more >
</div>
</div>
</div>
</div>
The problem is when media screen width is smaller than 767px, they are going to the left. I want to make image in the middle of column, the beginning of the text should be at the beginning of the imaeg and the end of text at the end of image, button should be at the beginning of the image too like here:
enter image description here
Just add width:100% to your images so they take all the space on the column
.buttons {
border: 1px solid #e86225;
color: #e86225 !important;
padding: 10px 20px;
font-size: 14px;
}
.buttons:hover {
border: 1px solid #ffffff;
background-color: #e86225;
color: #ffffff !important;
transition: background-color 1s, border 1s, color 1s;
}
.container-custom {
padding-top: 80px;
padding-bottom: 80px;
}
.custom-link {
padding: 15px 0;
}
.container p {
margin: 25px 0;
max-width: 400px;
}
img{
width:100%;
}
#media(max-width: 767px){
.container-custom {
padding-top: 50px;
padding-bottom: 50px;
}
}
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/css/bootstrap.min.css" integrity="sha384-GJzZqFGwb1QTTN6wy59ffF1BuGJpLSa9DkKMp0DgiMDm4iYMj70gZWKYbI706tWS" crossorigin="anonymous">
<div class="container">
<div class="row container-custom justify-content-center">
<h2>Blog</h2>
<div class='d-flex flex-wrap pt-5'>
<div class="col-sm-12 col-md-4">
<img src="https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcSHBMzMRL0g3ELio_DdCRvdajdF812AQPP2AbmM_jYr_66CnwgS" alt="">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque nibh sem, ultricies sit amet tellus ut, iaculis interdum ante. Quisque at nibh ac diam faucibus congue.
</p>
<div class="custom-link">
Read more >
</div>
</div>
<div class="col-sm-12 col-md-4">
<img src="https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQh3Afn3A1FKb24tpO6eAdqr8hCdnafjqwCNqgjdSAWK1igoWfk" alt="">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque nibh sem, ultricies sit amet tellus ut, iaculis interdum ante. Quisque at nibh ac diam faucibus congue.
</p>
<div class="custom-link">
Read more >
</div>
</div>
<div class="col-sm-12 col-md-4">
<img src="https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQFsb6TxovKdTNx-8gdo1R01nZXxRRauett2KQ_ci76VgjK2hR7" alt="">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque nibh sem, ultricies sit amet tellus ut, iaculis interdum ante. Quisque at nibh ac diam faucibus congue.
</p>
<div class="custom-link">
Read more >
</div>
</div>
</div>
</div>
The image width could be the issue. Add img { width: 100%; } and class="img-fluid" to your img tags.
Add to css:
img { width: 100%; }
HTML:
<img class="img-fluid" src="https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQh3Afn3A1FKb24tpO6eAdqr8hCdnafjqwCNqgjdSAWK1igoWfk" alt="">
or something similar so the images look like the layout in your attached image.
Example codepen using your code: https://codepen.io/brooksrelyt/pen/MZdLYj
I'm having trouble getting my images to resize fully.
Ideally I want the image to resize so that the option fits the screen, currently it only fits the width, why so? Is it possible to get the behavior I wish by just using css, maybe a media query is needed? Scorched over google trying to find a similar problem, but no luck!
Thanks in advance!
UPDATE:
To clarify, my problem is that the image is not resized, if the height of the window gets small enough - the header disappears and I get a scroll bar. I want all of the content to scale down, so that no scroll bar is needed.
.container {
min-height: 100vh;
display: flex;
flex-direction: column;
background-color: aqua;
}
.content {
display: flex;
overflow-x: auto;
flex: 2 1 auto;
flex-wrap: nowrap;
}
.content::-webkit-scrollbar {
display: none;
}
.option {
display: flex;
flex-direction: column;
margin: auto 1em;
width: 90%;
height: 70%;
text-align: justify;
border: 3px solid black;
}
.img {
flex: 1;
}
.title {
flex: 0;
font-weight: bold;
text-align: center;
flex: 1;
margin: auto;
}
.desc {
flex: 0;
}
.header {
flex: 2;
text-align: center;
background-color: red;
}
.footer {
flex: 1;
background-color: brown;
}
<div class="container">
<div class="header">
Fusce pellentesque ante.
</div>
<div class="content">
<div class="option">
<img class="img" src="https://www.w3schools.com/w3css/img_lights.jpg">
<p class="title">Proin hendrerit.</p>
<p class="desc">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur fringilla non lacus tincidunt suscipit. Nam nec arcu a erat convallis.</p>
</div>
<div class="option">
<img class="img" src="https://www.w3schools.com/w3css/img_lights.jpg">
<p class="title">Nullam at.</p>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed ut congue eros. Aenean sit amet quam efficitur, lacinia ligula ac.</p>
</div>
<div class="option">
<img class="img" src="https://www.w3schools.com/w3css/img_lights.jpg">
<p class="title">Sed nec.</p>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam porttitor nisi mauris, ac interdum tellus pulvinar id. Morbi non molestie</p>
</div>
<div class="option">
<img class="img" src="https://www.w3schools.com/w3css/img_lights.jpg">
<p class="title">Morbi in.</p>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam non rutrum arcu, ac posuere odio. Nunc in dolor eget nisi.</p>
</div>
<div class="option">
<img class="img" src="https://www.w3schools.com/w3css/img_lights.jpg">
<p class="title">Mauris ac.</p>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque pulvinar orci non consectetur accumsan. Aenean posuere, felis commodo congue pulvinar.</p>
</div>
</div>
<div class="footer">
<p>Quisque venenatis volutpat dictum. Praesent.</p>
</div>
</div>
Fiddle
Hope this is what you want. If this is the right answer! Here is what i did.
give the container class of height and width a 100% and set display to flex and flex-direction: column so header, footer and content class get aligned vertically.
Now, if you set content class flex prorperty to 1 it will take rest of width and height.
give option class a property of display: flex and set flex-direction: column so image and the title and description get aligned vertically.
by assign min-height of 30px to the title and p in the options, rest of the space can be assigned to image, which I hope is what you want.
* {
margin: 0;
padding: 0;
}
.content {
min-height: 100%;
width: 100%;
min-width: 100%;
display: flex;
flex-direction: row;
box-sizing: border-box;
padding: 30px 0;
}
.content .option {
flex: 1;
max-height: 100vh;
min-width: 100%;
display: flex;
flex-direction: column;
}
.content .option img {
height: calc(100% - 160px);
width: 100%;
}
.content .option p {
height: 20px;
}
.content .option p:nth-child(2) {
height: 40px;
}
.header,
.footer {
position: fixed;
left: 0;
right: 0;
background-color: #ccc;
height: 30px;
}
.header {
top: 0;
}
.footer {
bottom: 0;
}
<div class="container">
<div class="header">
Fusce pellentesque ante.
</div>
<div class="content">
<div class="option">
<img class="img" src="https://www.w3schools.com/w3css/img_lights.jpg">
<p class="title">Proin hendrerit.</p>
<p class="desc">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur fringilla non lacus tincidunt suscipit. Nam nec arcu a erat convallis.</p>
</div>
<div class="option">
<img class="img" src="https://www.w3schools.com/w3css/img_lights.jpg">
<p class="title">Nullam at.</p>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed ut congue eros. Aenean sit amet quam efficitur, lacinia ligula ac.</p>
</div>
<div class="option">
<img class="img" src="https://www.w3schools.com/w3css/img_lights.jpg">
<p class="title">Sed nec.</p>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam porttitor nisi mauris, ac interdum tellus pulvinar id. Morbi non molestie</p>
</div>
<div class="option">
<img class="img" src="https://www.w3schools.com/w3css/img_lights.jpg">
<p class="title">Morbi in.</p>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam non rutrum arcu, ac posuere odio. Nunc in dolor eget nisi.</p>
</div>
<div class="option">
<img class="img" src="https://www.w3schools.com/w3css/img_lights.jpg">
<p class="title">Mauris ac.</p>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque pulvinar orci non consectetur accumsan. Aenean posuere, felis commodo congue pulvinar.</p>
</div>
</div>
<div class="footer">
<p>Quisque venenatis volutpat dictum. Praesent.</p>
</div>
</div>
html,
body {
padding: 0;
margin: 0;
}
.container {
height: 100vh;
display: flex;
flex-direction: column;
background-color: aqua;
justify-content: space-between;
}
.header,
.footer {
flex: 0 1 auto;
text-align: center;
}
.content {
display: flex;
overflow-x: auto;
flex-wrap: nowrap;
flex: 1 1 auto;
}
.footer {
background-color: brown;
}
img {
max-width: 600px;
}
<div class="container">
<div class="header">
Fusce pellentesque ante.
</div>
<div class="content">
<div class="option">
<img class="img" src="https://www.w3schools.com/w3css/img_lights.jpg">
<p class="title">Proin hendrerit.</p>
<p class="desc">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur fringilla non lacus tincidunt suscipit. Nam nec arcu a erat convallis.</p>
</div>
<div class="option">
<img class="img" src="https://www.w3schools.com/w3css/img_lights.jpg">
<p class="title">Nullam at.</p>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed ut congue eros. Aenean sit amet quam efficitur, lacinia ligula ac.</p>
</div>
<div class="option">
<img class="img" src="https://www.w3schools.com/w3css/img_lights.jpg">
<p class="title">Sed nec.</p>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam porttitor nisi mauris, ac interdum tellus pulvinar id. Morbi non molestie</p>
</div>
<div class="option">
<img class="img" src="https://www.w3schools.com/w3css/img_lights.jpg">
<p class="title">Morbi in.</p>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam non rutrum arcu, ac posuere odio. Nunc in dolor eget nisi.</p>
</div>
<div class="option">
<img class="img" src="https://www.w3schools.com/w3css/img_lights.jpg">
<p class="title">Mauris ac.</p>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque pulvinar orci non consectetur accumsan. Aenean posuere, felis commodo congue pulvinar.</p>
</div>
</div>
<div class="footer">
<p>Quisque venenatis volutpat dictum. Praesent.</p>
</div>
</div>
I have 2 columns of data, in each column I have a paragraph and an image. I am wondering if there is a CSS-only method of making the paragraphs have the same height so that the images line up. I know I could loop through with JavaScript to find the tallest paragraph and set the height of the other to that, but I'm hoping to find a CSS solution if possible.
Additionally, I cannot modify the DOM structure.
.container {
display:flex;
}
.col {
padding:0 15px;
}
<div class="container">
<div class="col">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi fringilla ultrices nulla ac tempus.</p>
<img src="http://placehold.it/250x100" />
</div>
<div class="col">
<p>Nam mauris mi, eleifend et rutrum at, dignissim nec elit. Aliquam lacinia tincidunt leo, et pellentesque nibh ultricies ut. Etiam elit purus, blandit ac consequat a, dictum a dolor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>
<img src="http://placehold.it/250x100" />
</div>
</div>
I'm not sure Arup's example does what you expect - images still don't align. The answer has been updated.
Here's what should work for you:
.container {
display:flex;
}
.col {
padding:0 15px;
display: flex;
flex-direction: column;
justify-content: flex-end;
}
.col p {
flex: 1;
}
We set the main axis to be our y axis by using flex-direction and we justify the content such that everything in a col div sits at the bottom of this axis. Setting flex: 1; on the paragraph allows the paragraph to grow in order to occupy the free space in the div.
You can use flexbox for that, too. See the comments in CSS (borders added just for clarity):
.container {
display: flex;
}
.col {
padding:0 15px;
display: flex;
flex-direction: column; /* causes the image to go under the paragraph */
align-items: flex-start; /* images would stretch over the entire .col width without this */
border: 1px solid red;
}
.col p {
flex: 1; /* makes the paragraph grow to the tallest height available */
border: 1px solid blue;
}
<div class="container">
<div class="col">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi fringilla ultrices nulla ac tempus.</p>
<img src="http://placehold.it/250x100" />
</div>
<div class="col">
<p>Nam mauris mi, eleifend et rutrum at, dignissim nec elit. Aliquam lacinia tincidunt leo, et pellentesque nibh ultricies ut. Etiam elit purus, blandit ac consequat a, dictum a dolor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>
<img src="http://placehold.it/250x100" />
</div>
</div>
Add below styles.
.container {
display:flex;
}
.col {
padding: 5px 15px;
border: 1px solid #999;
display: flex;
flex-direction: column;
justify-content: space-between;
}
Live Example.
Given this code:
#wrapper {
border:2px solid red;
padding:10px;
width:310px; height:310px;
-webkit-column-width:150px; -webkit-column-gap:10px;
-moz-column-width:150px; -moz-column-gap:10px;
column-width:150px; column-gap:10px;
}
#wrapper > div {
width:150px;
background:#ccc;
margin-bottom:10px;
white-space:no-break;
}
<div id="wrapper">
<div>FIRST BOX: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi porttitor imperdiet dolor sit amet placerat. Phasellus vestibulum enim sed dui blandit nec dignissim justo sollicitudin. Phasellus vestibulum enim sed dui blandit nec dignissim justo sollicitudin.</div>
<div>SECOND BOX: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi porttitor imperdiet dolor sit amet placerat.</div>
<div>THIRD BOX: In at libero ipsum, vel cursus ante. Phasellus ac odio in tortor commodo venenati
I would like to arrange these 3 boxes into 2 columns using the CSS multi-column layout.
JSFiddle Demo
As you can see from my demo, it works. However, I'm concerned with the second box being fragmented into both columns. I would like to prevent this element fragmentation if possible. Is there any way to tell the browser not to fragment my boxes into multiple columns?
(Note that both the second and third box could easily fit into the second column, which is the arrangement I'd like to achieve.)
Some experimentation led me to:
-webkit-column-break-inside: avoid;
http://jsfiddle.net/7TXGS/
However, it doesn't work in Chrome Stable/Beta. It works in Chrome Canary (and Dev):
Probably using -webkit-column-break-after: always; with the FIRST BOX is appropriate.
<div id="wrapper">
<div> FIRST BOX: ... </div>
<div> SECOND BOX: ... </div>
<div> THIRD BOX: ... </div>
</div>
And this CSS code:
#wrapper {
border:2px solid red;
padding:10px;
width:310px;
//height:310px;
-webkit-column-width:150px; -webkit-column-gap:10px;
-moz-column-width:150px; -moz-column-gap:10px;
column-width:150px; column-gap:10px;
}
#wrapper > div {
width:150px;
background:#ccc;
margin-bottom:10px;
}
#wrapper > div:first-child {
-webkit-column-break-after: always;
}