Как применить нижнюю маржу для всех карт bootstrap? - PullRequest
0 голосов
/ 04 августа 2020

Я применил margin-bottom к карточке bootstrap, но это влияет только на вторую строку. это не влияет на первую строку. Как я могу это исправить?

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

Вот мой код: -

.card{
position: absolute;
margin-top: 45px;
margin-bottom: 500px;
}
.img{
  margin-top: 50px;
  position: relative;
  left: 90px;
  top: -60px;
}

1 Ответ

0 голосов
/ 04 августа 2020

Вам необходимо использовать margin-top на вашем .col-md-4. Установите image width на свое усмотрение.

Demo (откройте фрагмент на всю страницу, чтобы увидеть, что все шесть карточек работают)

img {
  margin-top: -66px;
  width: 75%;
}

.col-md-4 {
  margin-top: 5em;
}

.img {
  position: absolute;
  margin-left: 8em;
  z-index: 999999;
}

.row {
  padding: 2em;
}
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css">

<!-- jQuery library -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>

<!-- Popper JS -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.16.0/umd/popper.min.js"></script>

<!-- Latest compiled JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.0/js/bootstrap.min.js"></script>
<div class="row">
  <div class="col-md-4">
    <div class="img">
      <img src="https://via.placeholder.com/150">
    </div>
    <div class="card" style="width: 18rem;">
      <div class="card-body">
        <h5>Graphic Desiger</h5>
        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,
      </div>
    </div>
  </div>
  <div class="col-md-4">
    <div class="img">
      <img src="https://via.placeholder.com/150">
    </div>
    <div class="card" style="width: 18rem;">
      <div class="card-body">
        <h5>Developer</h5>
        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,
      </div>
    </div>
  </div>
  <div class="col-md-4">
    <div class="img">
      <img src="https://via.placeholder.com/150">
    </div>
    <div class="card" style="width: 18rem;">
      <div class="card-body">
        <h5>Front End</h5>
        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,
      </div>
    </div>
  </div>
  <div class="col-md-4">
    <div class="img">
      <img src="https://via.placeholder.com/150">
    </div>
    <div class="card" style="width: 18rem;">
      <div class="card-body">
        <h5>Front End</h5>
        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,
      </div>
    </div>
  </div>
  <div class="col-md-4">
    <div class="img">
      <img src="https://via.placeholder.com/150">
    </div>
    <div class="card" style="width: 18rem;">
      <div class="card-body">
        <h5>Front End</h5>
        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,
      </div>
    </div>
  </div>
  <div class="col-md-4">
    <div class="img">
      <img src="https://via.placeholder.com/150">
    </div>
    <div class="card" style="width: 18rem;">
      <div class="card-body">
        <h5>Front End</h5>
        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,
      </div>
    </div>
  </div>
</div>
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...