Z
Z
zlodiak2020-05-16 20:31:42
css
zlodiak, 2020-05-16 20:31:42

How to separate elements on different sides?

Please help me stick the green block to the right edge of the parent block. It is advisable to use only the features of flexbox. When squeezing the width of the browser window, the empty space between the 4th and 5th blocks should shrink and eventually disappear

DEMO

<div class="parent">
  <div class="child">1</div>
  <div class="child">2</div>
  <div class="child">3</div>
  <div class="child">4</div>
  <div class="child">5</div>
</div>


.parent {
  display: flex;
  border: cyan;
  border: 1px solid red;
}

  .child {
    width: 50px;
    height: 50px;
    border: 1px solid red;
  }
  
  .child:last-child {
    align-self: flex-end;
    background: lime;
  }

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question