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

234
Visualizações
How to complete rwd picture requirements without adding HTML

I have a project whose original screen structure is like the program example I attached!

Now the design draft requires that the original yellow block must appear below the green block on mobile devices, but my original HTML It is already arranged like this. I feel that if it is difficult to implement such a screen on a mobile device, I don't know how to accomplish such a screen change through css without adding HTML?

.demo {
  display: flex;
  justify-content: space-between;
}
.demo .main {
  flex: 2;
  background-color: #FBD148;
}
.demo .main .article {
  background-color: #49FF00;
  height: 200px;
}
.demo .main .reply {
  background-color: #3DB2FF;
  height: 200px;
}
.demo .about {
  flex: 1;
  background-color: #FBFF00;
  height: 200px;
}
<div class="demo">
  <div class="main">
       <div class="article">article</div>
       <div class="reply">reply</div>
  </div>
  <div class="about">about</div>
</div>

enter image description here

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

For solve this, the better way is to use display: grid in demo and main classes. The demo class will have two columns and two rows. In main will has only auto rows. With @media query we are redefine grid colums and rows in the demo and place the yellow element between green and blue.

:root {
  --height: 200px;
}

.demo {
  display: grid;
  grid-template-columns: 2fr 1fr;
  grid-template-rows: repeat(2, var(--height));
}

.demo .main {
  display: grid;
  grid-auto-rows: var(--height);
  background-color: #fbd148;
}

.demo .main .article {
  background-color: #49ff00;
}

.demo .main .reply {
  background-color: #3db2ff;
}

.demo .about {
  background-color: #fbff00;
}

@media screen and (max-width: 768px) {
  .demo {
    grid-template-columns: 1fr;
    grid-template-rows: repeat(3, var(--height));
  }
  .about {
    grid-column: 1;
    grid-row: 2;
  }
  .reply {
    grid-row: 3;
  }
}
<div class="demo">
  <div class="main">
    <div class="article">article</div>
    <div class="reply">reply</div>
  </div>
  <div class="about">about</div>
</div>

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