A
A
Alexander Vertelo2018-08-01 15:35:21
css
Alexander Vertelo, 2018-08-01 15:35:21

Why won't Flexbox start?

Target: a block of 5 cards ( div.block ), 2 of which are at the top (50% of the width of the div.two container ) and 3 of them are at the bottom (33% of the width of the div.three container ). With a gap of 12 pixels.
What does not work: the cards behave like a column, i.e. they do not become in one row, but under each other. I can't find the reason. In another similar case (all blocks of equal width), everything is as it should be. Thanks in advance)).

HTML:
<div class="wrap">
      <div class="two">
        <a class="block">
          <div class="case1">
            
          </div>
          <div class="case2">
            
          </div>
        </a>
        <a class="block">
          <div class="case1">
            
          </div>
          <div class="case2">
            
          </div>
        </a>
      </div>
      <div class="three">
        <a class="block">
          <div class="case1">
            
          </div>
        </a>
        <a class="block">
          <div class="case1">
            
          </div>
        </a>
        <a class="block">
          <div class="case1">
            
          </div>
        </a>
      </div>
    </div>

CSS:
.two, .three {
      display: flex; width: 100%;
      flex-flow: row wrap; justify-content: space-between;
    }
    .two .block, .three .block {
      display: block;
    }
    .two { margin: 0 0 12px 0;  }
    .three { margin: 12px 0 0 0; }
    .two .block { width: calc(50% - 6px); height: 256px; }
    .three .block { width: calc((100% / 3) - 8px); height: 172px; }

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Maxim Morozov, 2018-08-01
@MaxMorozov23

Why do you have display: block in css for .two .block, .three .block elements? Set display: flex and everything will work.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question