Вы можете просто добавить медиазапрос, в котором вы измените display
на block
для всех разделов (установите точку останова, если необходимо, здесь 720px, чтобы сразу показать мобильную версию, но, конечно, вы можете настроить ее, например, на 480px).
@media (max-width: 720px) {
section {
display: block;
}
}
Это деактивирует все параметры гибкости и установит width
в auto
(= полная ширина)
section {
max-width: 740px;
margin: 0 auto;
display: flex;
}
.column {
margin: 10px;
flex-grow: 1;
flex-shrink: 1;
flex-basis: 0;
}
section:nth-of-type(5) .column:first-of-type {
flex-grow: 2;
flex-shrink: 2;
flex-basis: 22px;
}
section:nth-of-type(6) .column:nth-of-type(2) {
flex-grow: 4;
flex-shrink: 4;
flex-basis: 66px;
}
/* OTHER STYLES */
html, body {
height: 100%;
box-sizing: border-box;
}
body {
font-family: 'Raleway', sans-serif;
padding: 10px;
background: linear-gradient(135deg, #b04, #f80) fixed;
}
.column {
padding: 10px 0;
background-color: rgba(255, 0, 0, 0.25);
text-align: center;
border: 1px solid rgba(255, 255, 255, 0.75);
background-color: rgba(255, 255, 255, 0.2);
color: rgba(255, 255, 255, 0.9);
}
@media (max-width: 720px) {
section {
display: block;
}
}
<section>
<div class="column">aa</div>
</section>
<section>
<div class="column">1</div>
<div class="column">2</div>
<div class="column">3</div>
</section>
<section>
<div class="column">aa</div>
</section>
<section>
<div class="column">1</div>
<div class="column">2</div>
<div class="column">3</div>
<div class="column">4</div>
</section>
<section>
<div class="column">aa</div>
</section>
<section>
<div class="column">1</div>
<div class="column">2</div>
<div class="column">3</div>
</section>