Выравнивание столбцов (справа / слева) с определенным эффектом - PullRequest
0 голосов
/ 14 октября 2019

Я изучаю CSS, и я интегрировал шаблон дизайна (PSD).

Я застрял в небольшой вещи, где мне пришлось выровнять 4 столбца , 2 послева и 2 справа ...

Проблема в том, что 2 столбца справа должны быть немного вниз по левому 2 столбцу. ( см. Рисунок )

Изображение

Я искал решение. ... но я не нашел точно то, что искал.

Я много чего перепробовал (начальная загрузка, margin-top ... и т. д.), но я думаю, что естьболее логичное решение ... Можете ли вы помочь мне?

Заранее спасибо.

Мой код:

.our-approach {
  height: fit-content;
  height: -webkit-fill-available;
  background-color: beige;
}
.our-approach-content {
  max-width: 730px;
  margin: auto;
}
.our-approach-content p {
  border-radius: 10px;
}
.our-approach-content .col {
  background-color: cadetblue;
  padding: 20px;
  border-radius: 10px;
  margin: 10px;
}
<section class="our-approach">
        <div class="container jumbotron">
          <div class="tl-content our-approach-content">
            <h1 class="text-center">Our Approach</h1>
            <h2 class="text-center">How we do it</h2>
            <div class="oac-legend">
            <div class="oac-l">
          <div class="row">
          <div class="col"><p>
                  Lorem Ipsum is simply dummy text of the printing and
                  typesetting industry. Lorem Ipsum has been the industry's
                  standard dummy text ever since the 1500s, when an unknown
                  printer took a galley of type and scrambled it to make a type
                  specimen book.
                </p></div>
              <div class="col"><p>
                  Lorem Ipsum is simply dummy text of the printing and
                  typesetting industry. Lorem Ipsum has been the industry's
                  standard dummy text ever since the 1500s, when an unknown
                  printer took a galley of type and scrambled it to make a type
                  specimen book.
                </p></div>
            </div>
            </div>
            <div class="oac-r">
              <div class="row">
            <div class="col">
              <p>
                  Lorem Ipsum is simply dummy text of the printing and
                  typesetting industry. Lorem Ipsum has been the industry's
                  standard dummy text ever since the 1500s, when an unknown
                  printer took a galley of type and scrambled it to make a type
                  specimen book.
                </p></div>
            <div class="col"><p>
                  Lorem Ipsum is simply dummy text of the printing and
                  typesetting industry. Lorem Ipsum has been the industry's
                  standard dummy text ever since the 1500s, when an unknown
                  printer took a galley of type and scrambled it to make a type
                  specimen book.
                </p></div>
          </div>
            </div>
          </div>
        </div>
        </div>
      </section>

Ответы [ 2 ]

1 голос
/ 14 октября 2019

Если вы поместите группы из двух в дополнительный div, а затем создадите верхний и нижний поля, это будет работать немного проще.

Например:

<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="utf-8" />
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
  <script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous">
  </script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous">
  </script>
  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous">
  </script>
</head>

<body>
  <div class='d-flex justify-content-around'>
    <div id='left-column'>
      <div>
        <p>top left</p>
      </div>
      <div class='mb-4'>
        <p>bottom left</p>
      </div>
    </div>
    <div id='right-column'>
      <div class='mt-4'>
        <p>top right</p>
      </div>
      <div>
        <p>bottom right</p>
      </div>
    </div>
  </div>
</body>

</html>
0 голосов
/ 15 октября 2019

Вы можете, конечно, показать это в начальной загрузке или любой другой. В начальной загрузке вы можете использовать этот код:

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">




<div class="container-fluid">
  <div class="row">
    <div class="col">
        <div>
        Title one
        </div>
        <div>
        Title two
        </div>
    </div>
    <div class="col">
    <br />
        <div>
        Title three
        </div>
        <div>
        Title four
        </div>
    </div>
  </div>
</div>






<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...