2

Как расположить блоки по такой схеме?

введите сюда описание изображения

2 ответа 2

4

Пока редко пользуюсь гридами в продакшене, но возможно в вашем случае это уместно:

body {
  margin: 0;
  padding: 0;
    display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr;
  grid-gap: 10px;
}

div {
  background-color: #000;
  min-height: 100px;
}

.center {
  grid-column: auto / span 2;
  grid-row: auto / span 2;
}
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div class="center"></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>

4

.flex { display: flex; }

.row div {
  height: 40px;
  width: 25%;
  margin: 2px;
  background-color: orange;
}

.aside {
  width: 25%;
  margin: 2px;
}

.aside div {
  height: 40px;
  width: 100%;
  margin-top: 4px;
  background-color: orange;
}
.aside div:first-child {
  margin-top: 0;
}

.central {
  width: calc(50% + 4px);
  margin: 2px;
  background-color: orange;
}
<div class="row flex">
  <div>1</div>
  <div>2</div>
  <div>3</div>
  <div>4</div>
</div>
<div class="flex">
  <div class="aside">
    <div>5</div>
    <div>7</div>
  </div>
  <div class="central"></div>
  <div class="aside">
    <div>6</div>
    <div>8</div>
  </div>
</div>
<div class="row flex">
  <div>9</div>
  <div>10</div>
  <div>11</div>
  <div>12</div>
</div>

Ваш ответ

By clicking “Отправить ответ”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Всё ещё ищете ответ? Посмотрите другие вопросы с метками или задайте свой вопрос.