A
A
Arbusik2021-10-02 01:32:31
css
Arbusik, 2021-10-02 01:32:31

How to move all product cards down without expanding the page?

When I move the cards, the screen expands.
HTML

<!--карточка товара-->
    <div class="wrap">
        <div class="card exmpl">
              <img src="1c20926eb904ab8d597253b3824c5515.jpg">
              <div class="name">
                  <h2>Диван Sunday</h2>
                  </p>
              </div>
              <div class="price">
                  <h4>344$</h4>
              </div>
              <p><button>Добавить в корзину</button></p>
          </div>
          <div class="card exmpl">
              <img src="1c20926eb904ab8d597253b3824c5515.jpg">
              <div class="name">
                  <h2>Диван Sunday</h2>
                  </p>
              </div>
              <div class="price">
                  <h4>344$</h4>
              </div>
              <p><button>Добавить в корзину</button></p>
          </div>
        <div class="card exmpl">
              <img src="1c20926eb904ab8d597253b3824c5515.jpg">
              <div class="name">
                  <h2>Диван Sunday</h2>
                  </p>
              </div>
              <div class="price">
                  <h4>344$</h4>
              </div>
              <p><button>Добавить в корзину</button></p>
          </div>
          <div class="card exmpl">
              <img src="1c20926eb904ab8d597253b3824c5515.jpg">
              <div class="name">
                  <h2>Диван Sunday</h2>
                  </p>
              </div>
              <div class="price">
                  <h4>344$</h4>
              </div>
              <p><button>Добавить в корзину</button></p>
          </div>
      </div>


css
/*Карточка товара*/
.card {
    background: #ffffff;
    width: 180px;
    height: 200px;
    border: 2px solid #000000;
    border-radius: 8px;
}


  .exmpl img {
    height: 135px;
    width: 100%;
    border: none;
    border-radius: 8px;
    margin-left: -2px;
    position: relative;
    top:-2.5px;
  }

  .name{
    text-align: center;
    position: relative;
    top: -50px;
}

.price{
  text-align: center;
  position: relative;
  top: -70px;
  color: #696969;
}
  .card button {
    border: none;
    outline: 0;
    padding: 12px;
    color: #ffffff;
    background-color: #000;
    text-align: center;
    cursor: pointer;
    width: 100%;
    height: 40px;
    font-size: 15px;
    position: relative;
    top: -87px;
  }
  
  .card button:hover {
    border-radius: 15px;
    background-color: #FFDEAD;
  }

.wrap {
  margin: 20px auto;
  display:grid;
  grid-template-columns: 185px 185px;
  grid-column-gap: 20px;
  grid-row-gap: 40px;
  position: relative;
  top: 100px;
}

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question