0

Подскажите пожалуйста как сделать адаптивный дизайн для сайта? Для сайт с карточками товара нужно сделать адаптив, что бы при уменьшении экрана между крточками оставалось пространство, header, main и footer имели отступы слева и справа. Например: после @media (1025px) последние две карточки находятся слева и справа по ширине. Хотелось бы что бы эти две карточки находились по центру экрана.

@import url('https://fonts.googleapis.com/css2?family=Maven+Pro:wght@400;500;600;700;800;900&display=swap');
*,
*:before,
*:after {
  margin: 0;
  padding: 0;
  border: 0;
  box-sizing: border-box;
  list-style: none;
  text-decoration: none;
}

a,
p,
h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: inherit;
  font-size: inherit;
  font-weight: inherit;
  font-style: inherit;
  text-decoration: none;
  color: inherit;
}

html,
body {
  height: 100%;
  color: #000;
  font-size: 14px;
  font-family: "Manrope", sans-serif;
  line-height: 1;
  
  background: linear-gradient(to right, #A1C4FD 0%, #C2E9FB 50%);
  
}

input,
textarea {
  outline: none;
}

.container {
  max-width: 90.5rem;
  margin: 0 auto;
  /* padding: 0 1rem;    */
}

.header {
  padding: 2rem 0;
  background-color: #fff;
  /* max-width: 96.5rem; */
  margin: 0 auto;
  /* border-radius: 0.9rem; */
}

.header__container {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.header__link {
  font-size: 1.5rem;
  font-weight: 700;
  color: #0046FF;
}

.header__button {
  flex: 0 0 16rem;
  display: flex;
  justify-content: flex-end;
  align-items: center;
}

.icon-menu {
  position: relative;
  flex: 0 0 1.9rem;
  height: 1.12rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  margin: 0px 0px 0px 20px;
}

.icon-menu::before,
.icon-menu::after {
  content: "";
  height: 2px;
  background-color: #000;
}

.icon-menu span {
  height: 2px;
  background-color: #000;
}

.header__login {
  background-color: #0046FF;
  color: #fff;
  line-height: 1.9rem;
  padding: 0.1rem 1.5rem;
  border-radius: 10px;
  text-transform: uppercase;
  font-weight: 600;
}

.search__container {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.search__row {
  display: flex;
  justify-content: space-between;
  margin: 2.5rem 0 2.5rem 0;
}

.search__row img:last-child {
  width: 40%;
}


/* .search__row img:first-child{
    width: 20%;
} */

@media screen and (max-width: 426px) {
  .search__row {
    margin: 0 0 1.25rem;
  }
  .search__row img:last-child {
    display: none;
  }
  .search__row img:first-child {
    margin: 0 auto;
  }
}

.search__bar {
  margin: 0 0 0 0;
}

.search__input {
  width: 100%;
  border: 2px solid #80A7E0;
  background: #fff;
  border-radius: 0.9rem;
  padding: 0.6rem 0.9rem;
}

.search__cards {
  margin: 25px 0;
}

.search__cards-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 0 0 2.5rem 0;
}

.search__cards-title {
  font-size: 2rem;
  font-weight: 700;
}

@media screen and (max-width: 426px) {
  .search__cards-title {
    font-size: 1.5rem;
  }
}

.search__cards-button {
  background-color: #0044ff;
  color: rgb(255, 255, 255);
  line-height: 3rem;
  height: 3rem;
  padding: 0 1.5rem;
  border-radius: 10px;
  /* text-transform: uppercase; */
  font-size: 2rem;
  /* font-weight: 700; */
}

.search__cards-content {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1.9rem;
}

.search__cards-item {
  width: 14rem;
  border-radius: 1rem;
  overflow: hidden;
  box-shadow: 0px 3px 7px rgba(0, 0, 0, 0.08);
  background-color: #fff;
}

@media screen and (max-width: 1350px) {
  .wrap {
    column-gap: 0 1rem;
  }
}

@media screen and (max-width: 1026px) {
  .search__cards-content:last-child {
    align-self: center;
    gap: 1rem;
  }
}


/* 
@media screen and (max-width: 1025px) {
    .search__cards-item{
        width: 31%;
        max-width: 100%;
    }
} */

@media screen and (min-width: 1026px) and (max-width: 1108px) {
  .search__cards-content {
    gap: 0.2rem;
  }
}

@media screen and (max-width: 769px) {
  .search__cards-item {
    width: 48%;
    max-width: 100%;
  }
}

@media screen and (max-width: 528px) {
  .search__cards-item {
    width: 100%;
    max-width: 100%;
  }
}

.search__cards-img {
  width: 100%;
  height: 13rem;
}

.search__cards-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.search__cards-description {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 0.6rem;
}

.search__cards-subtitle {
  font-size: 1.1rem;
  font-weight: 700;
  padding-left: 10px;
}

.search__cards-link {
  font-size: 12px;
  padding-right: 10px;
}

.scale {
  display: inline-block;
  overflow: hidden;
}

.scale img {
  transition: 1.5s;
  display: block;
}

.scale img:hover {
  transform: scale(1.2);
}

footer {
  /* max-width: 1380px; */
  height: 12.5rem;
  background-color: #fff;
  padding: 4.3rem 0;
  /* border-radius:0.9rem; */
  padding: 0 1rem;
  margin-top: 25px;
}

.row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  /* max-width: 98.5rem;
    margin: 0 auto; */
}

.footer__col {
  width: 25%;
  padding: 3rem 0 0 0;
}

.footer__col ul li:not(:last-child) {
  margin-bottom: 1.9rem;
}

.footer__col ul li a {
  font-size: 12px;
  text-transform: capitalize;
  font-weight: 500;
  display: block;
  color: rgb(128, 127, 128);
  transition: all 0.5s ease;
}

.footer__col ul li a:hover {
  color: #0046FF;
  padding-left: 0.5rem;
}

.footer__col a img {
  width: 30px;
  height: 30px;
  margin: 0 0 0 40px;
  transition: all 0.5s ease;
}

.footer__col a img:hover {
  transform: scale(1.5);
  transition: all 0.5s ease;
}

.footer__social-links {
  display: flex;
  justify-content: flex-end;
}

@media screen and (max-width: 1107px) {
  #sist2 {
    display: grid;
    justify-content: center;
    gap: 0.5rem;
  }
}
<div class="wrap">

  <header class="header">
    <div class="header__container wrapper container">
      <a class="header__link" href="#">ABC</a>
      <div class="header__button">
        <a class="header__login" href="#">Log in</a>
        <a href="#menu" type="button" class="menu__icon icon-menu"><span></span></a>
      </div>
    </div>
  </header>
  <!-- Main -->
  <div iv class="search wrapper">
    <div class="search__container container">
      <div class="search__row">
        <img src="img/logo.svg" alt="LOGO">
        <img src="img/bg1.svg" alt="Picture">
      </div>
      <form class="search__bar container ">
        <input class="search__input" type="text" placeholder="Find what you need...">
      </form>

      <!-- Search Cards first row -->
      <div class="search__cards container ">
        <div class="search__cards-header">
          <h3 class="search__cards-title">Сategories</h3>
          <a class="search__cards-button" href="#">Create Ad</a>
        </div>


        <div class="search__cards-content">
          <div class="search__cards-item">
            <div class="search__cards-img scale">
              <a href="#"><img src="https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQv9Nc1vr_cBW_frNDe8gnNTuTBbLVwcxBdcFh-y3-dTJpzeOrLbxMEcegIaF9-5lr8BMk&usqp=CAU" alt=""></a>
            </div>
            <div class="search__cards-description">
              <a class="search__cards-subtitle" href="#">Lorem</a>
              <a class="search__cards-link" href="#">View more →</a>
            </div>
          </div>

          <div class="search__cards-item">
            <div class="search__cards-img scale">
              <a href="#"><img src="https://images.unsplash.com/photo-1559297434-fae8a1916a79?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxzZWFyY2h8Nnx8dHJhbnNwb3J0fGVufDB8fDB8fA%3D%3D&auto=format&fit=crop&w=600&q=60" alt=""></a>
            </div>
            <div class="search__cards-description">
              <a class="search__cards-subtitle" href="#">Lorem</a>
              <a class="search__cards-link" href="#">View more →</a>
            </div>
          </div>

          <div class="search__cards-item">
            <div class="search__cards-img scale">
              <a href="#"><img src="https://images.unsplash.com/photo-1446694292248-2c2a7e575b1b?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxzZWFyY2h8NHx8dHJhbnNwb3J0fGVufDB8fDB8fA%3D%3D&auto=format&fit=crop&w=600&q=60" alt=""></a>
            </div>
            <div class="search__cards-description">
              <a class="search__cards-subtitle" href="#">Lorem</a>
              <a class="search__cards-link" href="#">View more →</a>
            </div>
          </div>

          <div class="search__cards-item">
            <div class="search__cards-img scale">
              <a href="#"><img src="https://images.unsplash.com/photo-1488998628026-a1a79746cdcd?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxzZWFyY2h8MTJ8fHRyYW5zcG9ydHxlbnwwfHwwfHw%3D&auto=format&fit=crop&w=600&q=60" alt=""></a>
            </div>
            <div class="search__cards-description">
              <a class="search__cards-subtitle" href="#">Lorem</a>
              <a class="search__cards-link" href="#">View more →</a>
            </div>
          </div>

          <div class="search__cards-item">
            <div class="search__cards-img scale">
              <a href="#"><img src="https://images.unsplash.com/photo-1614976523626-d598aafd4fda?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxzZWFyY2h8MTB8fHRyYW5zcG9ydHxlbnwwfHwwfHw%3D&auto=format&fit=crop&w=600&q=60" alt=""></a>
            </div>
            <div class="search__cards-description">
              <a class="search__cards-subtitle" href="#">Lorem</a>
              <a class="search__cards-link" href="#">View more →</a>
            </div>
          </div>

          <!-- Second row -->
          <div class="search__cards-item">
            <div class="search__cards-img scale">
              <a href="#"><img src="https://images.unsplash.com/photo-1475088092121-b7d3cd6e1482?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxzZWFyY2h8MTN8fHRyYW5zcG9ydHxlbnwwfHwwfHw%3D&auto=format&fit=crop&w=600&q=60" alt=""></a>
            </div>
            <div class="search__cards-description">
              <a class="search__cards-subtitle" href="#">Lorem</a>
              <a class="search__cards-link" href="#">View more →</a>
            </div>
          </div>


          <div class="search__cards-item">
            <div class="search__cards-img scale">
              <a href="#"><img src="https://images.unsplash.com/photo-1604778202015-3071e0d7f29b?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxzZWFyY2h8MTd8fHRyYW5zcG9ydHxlbnwwfHwwfHw%3D&auto=format&fit=crop&w=600&q=60" alt=""></a>
            </div>
            <div class="search__cards-description">
              <a class="search__cards-subtitle" href="#">Lorem</a>
              <a class="search__cards-link" href="#">View more →</a>
            </div>
          </div>

          <div class="search__cards-item">
            <div class="search__cards-img scale">
              <a href="#"><img src="https://images.unsplash.com/photo-1592963219838-6045ccbe0563?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxzZWFyY2h8MTR8fHRyYW5zcG9ydHxlbnwwfHwwfHw%3D&auto=format&fit=crop&w=600&q=60" alt=""></a>
            </div>
            <div class="search__cards-description">
              <a class="search__cards-subtitle" href="#">Lorem</a>
              <a class="search__cards-link" href="#">View more →</a>
            </div>
          </div>

          <div class="search__cards-item sist1">
            <div class="search__cards-img scale">
              <a href="#"><img src="https://images.unsplash.com/photo-1580981433573-c5804ced20ad?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxzZWFyY2h8NHx8bW9kZXxlbnwwfHwwfHw%3D&auto=format&fit=crop&w=600&q=60" alt=""></a>
            </div>
            <div class="search__cards-description">
              <a class="search__cards-subtitle" href="#">Lorem</a>
              <a class="search__cards-link" href="#">View more →</a>
            </div>
          </div>

          <div class="search__cards-item sist2">
            <div class="search__cards-img scale">
              <a href="#"><img src="https://images.unsplash.com/photo-1445264918150-66a2371142a2?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxzZWFyY2h8MjF8fHRyYW5zcG9ydHxlbnwwfHwwfHw%3D&auto=format&fit=crop&w=600&q=60" alt=""></a>
            </div>
            <div class="search__cards-description">
              <a class="search__cards-subtitle" href="#">Lorem</a>
              <a class="search__cards-link" href="#">View more →</a>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>

  <!-- Footer -->
  <footer class="footer">
    <div class="row container">
      <div class="footer__links footer__col">
        <ul class="footer_links-list">
          <li class="footer_links-items"><a href="#">Personal data policy</a></li>
          <li class="footer_links-items"><a href="#">Terms of use</a></li>
          <li class="footer_links-items"><a href="#">Rules</a></li>
        </ul>
      </div>

      <div class="footer__links footer__col">
        <ul class="footer__links-list">
          <li class="footer_links-items"><a href="#">About us</a></li>
          <li class="footer_links-items"><a href="#">Contact us</a></li>
          <li class="footer_links-items"><a href="#">Careers</a></li>
        </ul>
      </div>


      <div class="footer__links footer__col">
        <div class="footer__social-links links">
          <a href=""><img src="https://img.icons8.com/fluency/344/pinterest.png" alt="I"></a>
          <a href=""><img src="https://img.icons8.com/plasticine/2x/instagram-new--v2.png" alt="T"></a>
          <a href=""><img src="https://img.icons8.com/color/2x/twitter.png" alt="D"></a>
          <a href=""><img src="https://img.icons8.com/color/2x/facebook.png" alt="F"></a>


        </div>
      </div>


    </div>

  </footer>
</div>

1 ответ 1

1

В целом у Вас уже всё готово, но ошибки конечно допустили. Например, Вам надо чтобы были отступы у контейнеров по бокам, а сами их комментируете. Ещё Ваша ошибка в том, что Вы используете контейнер внутри контейнера, это не правильно, у Вас из-за этого выйдут дополнительные отступы. Контейнер используйте либо только у общего тега для всех секций, либо на каждой секции по отдельности. А для того, чтобы Ваши карточки встали по центру, есть иное значение у justify-content - center. Однако, это применится ведь на все Ваши карточки, поэтому они все прижмутся к центру. Вы задали карточкам фиксированный размер ширины, для данного случая я бы использовал процент.

@import url('https://fonts.googleapis.com/css2?family=Maven+Pro:wght@400;500;600;700;800;900&display=swap');
*,
*:before,
*:after {
  margin: 0;
  padding: 0;
  border: 0;
  box-sizing: border-box;
  list-style: none;
  text-decoration: none;
}

a,
p,
h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: inherit;
  font-size: inherit;
  font-weight: inherit;
  font-style: inherit;
  text-decoration: none;
  color: inherit;
}

html,
body {
  height: 100%;
  color: #000;
  font-size: 14px;
  font-family: "Manrope", sans-serif;
  line-height: 1;
  background: linear-gradient(to right, #A1C4FD 0%, #C2E9FB 50%);
}

input,
textarea {
  outline: none;
}

.container {
  max-width: 90.5rem;
  margin: 0 auto;
  padding: 0 1rem;
  /* раскомментируйте и будут Вам отступы */
}

.header {
  padding: 2rem 0;
  background-color: #fff;
  /* max-width: 96.5rem; */
  margin: 0 auto;
  /* border-radius: 0.9rem; */
}

.header__container {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.header__link {
  font-size: 1.5rem;
  font-weight: 700;
  color: #0046FF;
}

.header__button {
  flex: 0 0 16rem;
  display: flex;
  justify-content: flex-end;
  align-items: center;
}

.icon-menu {
  position: relative;
  flex: 0 0 1.9rem;
  height: 1.12rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  margin: 0px 0px 0px 20px;
}

.icon-menu::before,
.icon-menu::after {
  content: "";
  height: 2px;
  background-color: #000;
}

.icon-menu span {
  height: 2px;
  background-color: #000;
}

.header__login {
  background-color: #0046FF;
  color: #fff;
  line-height: 1.9rem;
  padding: 0.1rem 1.5rem;
  border-radius: 10px;
  text-transform: uppercase;
  font-weight: 600;
}

.search__container {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.search__row {
  display: flex;
  justify-content: space-between;
  margin: 2.5rem 0 2.5rem 0;
}

.search__row img:last-child {
  width: 40%;
}


/* .search__row img:first-child{
    width: 20%;
} */

@media screen and (max-width: 426px) {
  .search__row {
    margin: 0 0 1.25rem;
  }
  .search__row img:last-child {
    display: none;
  }
  .search__row img:first-child {
    margin: 0 auto;
  }
}

.search__bar {
  margin: 0 0 0 0;
}

.search__input {
  width: 100%;
  border: 2px solid #80A7E0;
  background: #fff;
  border-radius: 0.9rem;
  padding: 0.6rem 0.9rem;
}

.search__cards {
  margin: 25px 0;
}

.search__cards-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 0 0 2.5rem 0;
}

.search__cards-title {
  font-size: 2rem;
  font-weight: 700;
}

@media screen and (max-width: 426px) {
  .search__cards-title {
    font-size: 1.5rem;
  }
}

.search__cards-button {
  background-color: #0044ff;
  color: rgb(255, 255, 255);
  line-height: 3rem;
  height: 3rem;
  padding: 0 1.5rem;
  border-radius: 10px;
  /* text-transform: uppercase; */
  font-size: 2rem;
  /* font-weight: 700; */
}

.search__cards-content {
  display: flex;
  justify-content: center;
  /* отцентрует Ваши карточки */
  flex-wrap: wrap;
  gap: 1.9rem;
}

.search__cards-item {
  width: 14rem;
  border-radius: 1rem;
  overflow: hidden;
  box-shadow: 0px 3px 7px rgba(0, 0, 0, 0.08);
  background-color: #fff;
}

@media screen and (max-width: 1350px) {
  .wrap {
    column-gap: 0 1rem;
  }
}

@media screen and (max-width: 1026px) {
  .search__cards-content:last-child {
    align-self: center;
    gap: 1rem;
  }
}


/* 
@media screen and (max-width: 1025px) {
    .search__cards-item{
        width: 31%;
        max-width: 100%;
    }
} */

@media screen and (min-width: 1026px) and (max-width: 1108px) {
  .search__cards-content {
    gap: 0.2rem;
  }
}

@media screen and (max-width: 769px) {
  .search__cards-item {
    width: 48%;
    max-width: 100%;
  }
}

@media screen and (max-width: 528px) {
  .search__cards-item {
    width: 100%;
    max-width: 100%;
  }
}

.search__cards-img {
  width: 100%;
  height: 13rem;
}

.search__cards-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.search__cards-description {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 0.6rem;
}

.search__cards-subtitle {
  font-size: 1.1rem;
  font-weight: 700;
  padding-left: 10px;
}

.search__cards-link {
  font-size: 12px;
  padding-right: 10px;
}

.scale {
  display: inline-block;
  overflow: hidden;
}

.scale img {
  transition: 1.5s;
  display: block;
}

.scale img:hover {
  transform: scale(1.2);
}

footer {
  /* max-width: 1380px; */
  height: 12.5rem;
  background-color: #fff;
  padding: 4.3rem 0;
  /* border-radius:0.9rem; */
  padding: 0 1rem;
  margin-top: 25px;
}

.row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  /* max-width: 98.5rem;
    margin: 0 auto; */
}

.footer__col {
  width: 25%;
  padding: 3rem 0 0 0;
}

.footer__col ul li:not(:last-child) {
  margin-bottom: 1.9rem;
}

.footer__col ul li a {
  font-size: 12px;
  text-transform: capitalize;
  font-weight: 500;
  display: block;
  color: rgb(128, 127, 128);
  transition: all 0.5s ease;
}

.footer__col ul li a:hover {
  color: #0046FF;
  padding-left: 0.5rem;
}

.footer__col a img {
  width: 30px;
  height: 30px;
  margin: 0 0 0 40px;
  transition: all 0.5s ease;
}

.footer__col a img:hover {
  transform: scale(1.5);
  transition: all 0.5s ease;
}

.footer__social-links {
  display: flex;
  justify-content: flex-end;
}

@media screen and (max-width: 1107px) {
  #sist2 {
    display: grid;
    justify-content: center;
    gap: 0.5rem;
  }
}
<div class="wrap">
  <header class="header">
    <div class="header__container wrapper container">
      <a class="header__link" href="#">ABC</a>
      <div class="header__button">
        <a class="header__login" href="#">Log in</a>
        <a href="#menu" type="button" class="menu__icon icon-menu"><span></span></a>
      </div>
    </div>
  </header>
  <!-- Main -->
  <div iv class="search wrapper container">
    <div class="search__container">
      <div class="search__row">
        <img src="img/logo.svg" alt="LOGO">
        <img src="img/bg1.svg" alt="Picture">
      </div>
      <form class="search__bar">
        <input class="search__input" type="text" placeholder="Find what you need...">
      </form>
      <!-- Search Cards first row -->
      <div class="search__cards">
        <div class="search__cards-header">
          <h3 class="search__cards-title">Сategories</h3>
          <a class="search__cards-button" href="#">Create Ad</a>
        </div>
        <div class="search__cards-content">
          <div class="search__cards-item">
            <div class="search__cards-img scale">
              <a href="#"><img src="https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQv9Nc1vr_cBW_frNDe8gnNTuTBbLVwcxBdcFh-y3-dTJpzeOrLbxMEcegIaF9-5lr8BMk&usqp=CAU" alt=""></a>
            </div>
            <div class="search__cards-description">
              <a class="search__cards-subtitle" href="#">Lorem</a>
              <a class="search__cards-link" href="#">View more →</a>
            </div>
          </div>
          <div class="search__cards-item">
            <div class="search__cards-img scale">
              <a href="#"><img src="https://images.unsplash.com/photo-1559297434-fae8a1916a79?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxzZWFyY2h8Nnx8dHJhbnNwb3J0fGVufDB8fDB8fA%3D%3D&auto=format&fit=crop&w=600&q=60" alt=""></a>
            </div>
            <div class="search__cards-description">
              <a class="search__cards-subtitle" href="#">Lorem</a>
              <a class="search__cards-link" href="#">View more →</a>
            </div>
          </div>
          <div class="search__cards-item">
            <div class="search__cards-img scale">
              <a href="#"><img src="https://images.unsplash.com/photo-1446694292248-2c2a7e575b1b?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxzZWFyY2h8NHx8dHJhbnNwb3J0fGVufDB8fDB8fA%3D%3D&auto=format&fit=crop&w=600&q=60" alt=""></a>
            </div>
            <div class="search__cards-description">
              <a class="search__cards-subtitle" href="#">Lorem</a>
              <a class="search__cards-link" href="#">View more →</a>
            </div>
          </div>
          <div class="search__cards-item">
            <div class="search__cards-img scale">
              <a href="#"><img src="https://images.unsplash.com/photo-1488998628026-a1a79746cdcd?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxzZWFyY2h8MTJ8fHRyYW5zcG9ydHxlbnwwfHwwfHw%3D&auto=format&fit=crop&w=600&q=60" alt=""></a>
            </div>
            <div class="search__cards-description">
              <a class="search__cards-subtitle" href="#">Lorem</a>
              <a class="search__cards-link" href="#">View more →</a>
            </div>
          </div>
          <div class="search__cards-item">
            <div class="search__cards-img scale">
              <a href="#"><img src="https://images.unsplash.com/photo-1614976523626-d598aafd4fda?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxzZWFyY2h8MTB8fHRyYW5zcG9ydHxlbnwwfHwwfHw%3D&auto=format&fit=crop&w=600&q=60" alt=""></a>
            </div>
            <div class="search__cards-description">
              <a class="search__cards-subtitle" href="#">Lorem</a>
              <a class="search__cards-link" href="#">View more →</a>
            </div>
          </div>
          <!-- Second row -->
          <div class="search__cards-item">
            <div class="search__cards-img scale">
              <a href="#"><img src="https://images.unsplash.com/photo-1475088092121-b7d3cd6e1482?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxzZWFyY2h8MTN8fHRyYW5zcG9ydHxlbnwwfHwwfHw%3D&auto=format&fit=crop&w=600&q=60" alt=""></a>
            </div>
            <div class="search__cards-description">
              <a class="search__cards-subtitle" href="#">Lorem</a>
              <a class="search__cards-link" href="#">View more →</a>
            </div>
          </div>
          <div class="search__cards-item">
            <div class="search__cards-img scale">
              <a href="#"><img src="https://images.unsplash.com/photo-1604778202015-3071e0d7f29b?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxzZWFyY2h8MTd8fHRyYW5zcG9ydHxlbnwwfHwwfHw%3D&auto=format&fit=crop&w=600&q=60" alt=""></a>
            </div>
            <div class="search__cards-description">
              <a class="search__cards-subtitle" href="#">Lorem</a>
              <a class="search__cards-link" href="#">View more →</a>
            </div>
          </div>
          <div class="search__cards-item">
            <div class="search__cards-img scale">
              <a href="#"><img src="https://images.unsplash.com/photo-1592963219838-6045ccbe0563?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxzZWFyY2h8MTR8fHRyYW5zcG9ydHxlbnwwfHwwfHw%3D&auto=format&fit=crop&w=600&q=60" alt=""></a>
            </div>
            <div class="search__cards-description">
              <a class="search__cards-subtitle" href="#">Lorem</a>
              <a class="search__cards-link" href="#">View more →</a>
            </div>
          </div>
          <div class="search__cards-item sist1">
            <div class="search__cards-img scale">
              <a href="#"><img src="https://images.unsplash.com/photo-1580981433573-c5804ced20ad?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxzZWFyY2h8NHx8bW9kZXxlbnwwfHwwfHw%3D&auto=format&fit=crop&w=600&q=60" alt=""></a>
            </div>
            <div class="search__cards-description">
              <a class="search__cards-subtitle" href="#">Lorem</a>
              <a class="search__cards-link" href="#">View more →</a>
            </div>
          </div>
          <div class="search__cards-item sist2">
            <div class="search__cards-img scale">
              <a href="#"><img src="https://images.unsplash.com/photo-1445264918150-66a2371142a2?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxzZWFyY2h8MjF8fHRyYW5zcG9ydHxlbnwwfHwwfHw%3D&auto=format&fit=crop&w=600&q=60" alt=""></a>
            </div>
            <div class="search__cards-description">
              <a class="search__cards-subtitle" href="#">Lorem</a>
              <a class="search__cards-link" href="#">View more →</a>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
  <!-- Footer -->
  <footer class="footer">
    <div class="row container">
      <div class="footer__links footer__col">
        <ul class="footer_links-list">
          <li class="footer_links-items"><a href="#">Personal data policy</a></li>
          <li class="footer_links-items"><a href="#">Terms of use</a></li>
          <li class="footer_links-items"><a href="#">Rules</a></li>
        </ul>
      </div>
      <div class="footer__links footer__col">
        <ul class="footer__links-list">
          <li class="footer_links-items"><a href="#">About us</a></li>
          <li class="footer_links-items"><a href="#">Contact us</a></li>
          <li class="footer_links-items"><a href="#">Careers</a></li>
        </ul>
      </div>
      <div class="footer__links footer__col">
        <div class="footer__social-links links">
          <a href=""><img src="https://img.icons8.com/fluency/344/pinterest.png" alt="I"></a>
          <a href=""><img src="https://img.icons8.com/plasticine/2x/instagram-new--v2.png" alt="T"></a>
          <a href=""><img src="https://img.icons8.com/color/2x/twitter.png" alt="D"></a>
          <a href=""><img src="https://img.icons8.com/color/2x/facebook.png" alt="F"></a>
        </div>
      </div>
    </div>
  </footer>
</div>

2
  • Спасибо за развернутый ответ. У меня возникло несколько вопросов. Как я понял вы задали всем карточкам расположиться по центру, верно? Мне хотелось бы что бы в начале все элементы были расположены по одной оси Y, другими словами все элементы расположены по левому и правому краю родительского diva/контейнера. При адаптиве последние карточки хотелось бы расположить в центре как в вашем варианте кода, то есть параллельно двум карточкам выше. Надеюсь я смог правильно донести мои мысли...)))
    – Kevlar
    11 июл 2022 в 8:43
  • При данных свойствах, flex заполняет карточками свой блок из центра в края. И я не совсем понимаю как Вы хотите расположить карточки
    – SLideR11
    12 июл 2022 в 1:01

Ваш ответ

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

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