How do I prevent one element from overlapping another?

Asked

Viewed 2,919 times

0

All right, here’s the deal. I have a div, which in my case is the body of the page, within this div I have two edges, the right and the left, and inside the div I also have a flexbox with some images. It looks right, but when the page size decreases the flexbox images are above the right edge.

  • missing you put css and html, and if you can a screenshot of the result

  • Rafael without your HTML and CSS not to answer you, edit your question as the code you already have

1 answer

1

All explained in the code. (source: https://origamid.com/projetos/flexbox-guia-completo)

.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>

Browser other questions tagged

You are not signed in. Login or sign up in order to post.