0

I have the following (codepen)

.container{column-count:2; width: 50%; border: 1px solid;}
.entry{border: 1px dotted red;}
<div class="container">
  <div class="entry">
    <h3>header 1</h3>
    <div class="item">item 1</div>
    <div class="item">item 2</div>
    <div class="item">item 3</div>
  </div>
  <div class="entry">
    <h3>header 1</h3>
    <div class="item">item 1</div>
    <div class="item">item 2</div>
    <div class="item">item 3</div>
  </div>
  <div class="entry">
    <h3>header 1</h3>
    <div class="item">item 1</div>
    <div class="item">item 2</div>
    <div class="item">item 3</div>
  </div>
  <div class="entry">
    <h3>header 1</h3>
    <div class="item">item 1</div>
    <div class="item">item 2</div>
    <div class="item">item 3</div>
  </div>
  <div class="entry">
    <h3>header 1</h3>
    <div class="item">item 1</div>
    <div class="item">item 2</div>
    <div class="item">item 3</div>
  </div>  
</div>

is there a way to keep the "red" blocks to be inseparable? I mean, pass to the second column entirely, as a whole block?

enter image description here

serge
  • 13,940
  • 35
  • 121
  • 205
  • @Terry unfortunately the "duplicate" solutions don't solve the problem... – serge Apr 26 '18 at 09:40
  • Yes it does, as per this answer: https://stackoverflow.com/a/17415553/395910. Apply it to the `.entry` element, not the parent. – Terry Apr 26 '18 at 09:57

1 Answers1

2

Adding display: inline-block to the entry class should work. CSS:

.container{
  column-count: 2; 
  width: 50%; 
  border: 1px solid;
}
.entry{
  border: 1px dotted red;
  display: inline-block;
  width: 100%;
 }
Arvind Muthuraman
  • 2,957
  • 1
  • 12
  • 11