Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

203
Visualizações
How do I scroll horizontally in responsive view?

As you can see in the picture, the cards are arranged one after the other. But I want it to be scrolled sideways instead of sorting it one under the other.

enter image description here

How can I solve it?

html

<div className="home__container only-mobile">
  <div className="home__content">
    <h3>{t('home.for_me')}</h3>
    <div>
      {campaignData
        ? campaignData.map((campaign, i) => {
          return (
            <DiscountPolicyCard
              campaignList={campaign}
              key={'campaignMobile' + i.toString()}
            />
          );
        })
        : null}
    </div>
  </div>
</div>

css

.home__container.only-mobile {
  display: grid;
  place-content: center;

  .home__content {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    width: 180px;

    h3 {
      color: gray;
    }

    &>div {
      justify-content: center;
      align-items: center;
    }
  }
}
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

.container {
  display: flex;
  flex-wrap: no-wrap;
  gap: 1rem;
  max-width: 100%;
  overflow: auto;
}

.inner {
  background: lime;
  min-width: 200px;
  height: 100px;
}
<div class="container">
  <div class="inner">
  </div>
  <div class="inner">
  </div>
  <div class="inner">
  </div>
  <div class="inner">
  </div>
  <div class="inner">
  </div>
</div>

Remove the flex-wrap: wrap; it tells the browser to wrap elements inside of a flexbox if there is not enough space and that's bascially the opposite of what you are trying to achieve. If it doesn't work out of the box after deleting add flex-wrap: no-wrap; instead and add a min-width to the containers to make sure they don't get squished.

That's the first step after that make the container max-width: 100% and overflow: auto that should be it.

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda