How do I make one element not overlap another?

-1

It is as follows. I have a div, which in my case is the body of the page, tooth of this div I have two borders, right and left, and inside the div I also have a flexbox with some images. It works fine, but when the page size decreases, the flexbox images are over the right border.

    
asked by anonymous 04.07.2018 / 00:42

1 answer

1

Everything explained in the code. (source: link )

.container {
  max-width: 360px;
  margin: 0 auto;
  display: flex;
  border: 1px solid #ccc;
}

.wrap {
  /* Quebra a linha assim que um dos flex itens não puder mais ser compactado. */
  flex-wrap: wrap;
}

.item {
  /* O flex: 1; é necessário para que cada item se expanda ocupando o tamanho máximo do container. */
  flex: 1;
  margin: 5px;
  background: tomato;
  text-align: center;
  font-size: 1.5em;
}

h1 {
  text-align: center;
  margin: 20px 0 0 0;
  font-size: 1.25em;
  font-weight: normal;
}
<h1>flex-wrap: wrap;</h1>
<section class="container wrap">
  <div class="item">TesteDoItem1</div>
  <div class="item">TesteDoItem2</div>
  <div class="item">TesteDoItem3</div>
</section>
    
04.07.2018 / 15:09