Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

The button under the card

I have product cards, I want to have product cards, I want to add a "Buy" button under them. But the button is constantly moving to the right. How do I put a button so that each button is under its own card? I have tried to do this in various ways, but without success.ㅤㅤㅤㅤㅤㅤ
ㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤ

.product-card-container {
  display: flex;
  justify-content: space-around;
  flex-wrap: wrap;
}

.nft {
  user-select: none;
  width: 300px;
  margin: 2rem;
  border: 1px solid #ffffff22;
  background-color: #282c34;
  background: linear-gradient(0deg, rgba(40, 44, 52, 1) 0%, rgba(17, 0, 32, .5) 100%);
  box-shadow: 0 7px 20px 5px #00000088;
  border-radius: .7rem;
  backdrop-filter: blur(7px);
  -webkit-backdrop-filter: blur(7px);
  overflow: hidden;
  transition: .5s all;

  hr {
    width: 100%;
    border: none;
    border-bottom: 1px solid #88888855;
    margin-top: 0;
  }
  ins {
    text-decoration: none;
  }
  .main {
    width: 90%;
    padding: 1rem;
    color: #c572e6;
    display: flex;
    flex-direction: column;
    .tokenImage {
      border-radius: .5rem;
      max-width: 100%;
      height: 250px;
      object-fit: cover;
    }
    .description {
      min-height: 100px;
      max-height: 100px;
      margin: .5rem 0;
      color: #a89ec9;
    }
    .tokenInfo{
      display: flex;
      justify-content: space-between;
      align-items: center;
      .price{
        display: flex;
        align-items: center;
        color: #ee83e5;
        font-weight: 700;
        ins{
          margin-left: -.3rem;
          margin-right: .5rem;
        }
      }
      .duration{
        display: flex;
        align-items: center;
        color: #a89ec9;
        margin-right: .2rem;
        ins{
          margin: .5rem;
          margin-bottom: .4rem;
        }
      }
    }
    .creator {
      display: flex;
      align-items: center;
      margin-top: .2rem;
      margin-bottom: -.3rem;
      ins {
        color: #a89ec9;
        text-decoration: none;
      }
      .wrapper {
        display: flex;
        align-items: center;
        border: 1px solid #ffffff22;
        padding: .3rem;
        margin: 0;
        margin-right: .5rem;
        border-radius: 100%;
        box-shadow: inset 0 0 0 4px #000000aa;
        img {
          border-radius: 100%;
          border: 1px solid #ffffff22;
          width: 2rem;
          height: 2rem;
          object-fit: cover;
          margin: 0;
        }
      }
    }
  }
   ::before {
    position: fixed;
    content: "";
    box-shadow: 0 0 100px 40px #ffffff08;
    top: -10%;
    left: -100%;
    transform: rotate(-45deg);
    height: 60rem;
    transition: .7s all;
  }
  &:hover {
    border: 1px solid #ffffff44;
    box-shadow: 0 7px 50px 10px #000000aa;
    transform: scale(1.015);
    filter: brightness(1.3);
     ::before {
      filter: brightness(.5);
      top: -100%;
      left: 200%;
    }
  }
}

.bg {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  h1 {
    font-size: 20rem;
    filter: opacity(0.5);
  }
}
.buttons {
    margin: 10%;
    text-align: center;
}

.btn-hover {
    width: 200px;
    font-size: 16px;
    font-weight: 600;
    color: #fff;
    cursor: pointer;
    margin: 20px;
    height: 55px;
    text-align:center;
    border: none;
    background-size: 300% 100%;

    border-radius: 50px;
    moz-transition: all .4s ease-in-out;
    -o-transition: all .4s ease-in-out;
    -webkit-transition: all .4s ease-in-out;
    transition: all .4s ease-in-out;
}

.btn-hover:hover {
    background-position: 100% 0;
    moz-transition: all .4s ease-in-out;
    -o-transition: all .4s ease-in-out;
    -webkit-transition: all .4s ease-in-out;
    transition: all .4s ease-in-out;
}

.btn-hover:focus {
    outline: none;
}

.btn-hover.color-7 {
    background-image: linear-gradient(to right, #6253e1, #852D91, #A3A1FF, #F24645);
    box-shadow: 0 4px 15px 0 rgba(126, 52, 161, 0.75);
}
<div class="product-card-container">
    <div class="nft"  onclick="addProd('11', products)" class="card" >
        <div class='main'>
          <img class='tokenImage' src="{{ url_for('static', filename='img/м1.jpg') }}" alt="NFT" />
          <h2>Набор</h2>
          <p class='description'></p>
          <div class='tokenInfo'>
            <div class="price">
              <ins>◘</ins>
              <p>499 Руб</p>
            </div>
          </div>
        </div>
     </div>
<button class="btn-hover color-7">BUTTON</button>
     <div class="nft" onclick="addProd('12', products)" class="card" >
        <div class='main'>
          <img class='tokenImage' src="{{ url_for('static', filename='img/м2.jpg') }}" alt="NFT" />
          <h2>Заяц</h2>
          <p class='description'></p>
          <div class='tokenInfo'>
            <div class="price">
              <ins>◘</ins>
              <p>179 Руб</p>
            </div>
          </div>
        </div>
     </div>
    <button class="btn-hover color-7">BUTTON</button>
     <div class="nft" onclick="addProd('13', products)" class="card" >
        <div class='main'>
          <img class='tokenImage' src="{{ url_for('static', filename='img/м3.jpg') }}" alt="NFT" />
          <h2>Массажка</h2>
          <p class='description'></p>
          <div class='tokenInfo'>
            <div class="price">
              <ins>◘</ins>
              <p>179 Руб</p>
            </div>
          </div>
        </div>
     </div>
<button class="btn-hover color-7">BUTTON</button>
 </div>

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

You need to wrap your div.nft with the button in a wrapper div. You can then style it as you want (center it ..). Here I added some css to center buttons.

.product-card-container {
  display: flex;
  justify-content: space-around;
  flex-wrap: wrap;
}

.wrapper_div{        /*------added this to center button-------*/
  display:flex;
  flex-direction: column;
  align-items:center;
}

.nft {
  user-select: none;
  width: 300px;
  margin: 2rem;
  border: 1px solid #ffffff22;
  background-color: #282c34;
  background: linear-gradient(0deg, rgba(40, 44, 52, 1) 0%, rgba(17, 0, 32, .5) 100%);
  box-shadow: 0 7px 20px 5px #00000088;
  border-radius: .7rem;
  backdrop-filter: blur(7px);
  -webkit-backdrop-filter: blur(7px);
  overflow: hidden;
  transition: .5s all;

  hr {
    width: 100%;
    border: none;
    border-bottom: 1px solid #88888855;
    margin-top: 0;
  }
  ins {
    text-decoration: none;
  }
  .main {
    width: 90%;
    padding: 1rem;
    color: #c572e6;
    display: flex;
    flex-direction: column;
    .tokenImage {
      border-radius: .5rem;
      max-width: 100%;
      height: 250px;
      object-fit: cover;
    }
    .description {
      min-height: 100px;
      max-height: 100px;
      margin: .5rem 0;
      color: #a89ec9;
    }
    .tokenInfo{
      display: flex;
      justify-content: space-between;
      align-items: center;
      .price{
        display: flex;
        align-items: center;
        color: #ee83e5;
        font-weight: 700;
        ins{
          margin-left: -.3rem;
          margin-right: .5rem;
        }
      }
      .duration{
        display: flex;
        align-items: center;
        color: #a89ec9;
        margin-right: .2rem;
        ins{
          margin: .5rem;
          margin-bottom: .4rem;
        }
      }
    }
    .creator {
      display: flex;
      align-items: center;
      margin-top: .2rem;
      margin-bottom: -.3rem;
      ins {
        color: #a89ec9;
        text-decoration: none;
      }
      .wrapper {
        display: flex;
        align-items: center;
        border: 1px solid #ffffff22;
        padding: .3rem;
        margin: 0;
        margin-right: .5rem;
        border-radius: 100%;
        box-shadow: inset 0 0 0 4px #000000aa;
        img {
          border-radius: 100%;
          border: 1px solid #ffffff22;
          width: 2rem;
          height: 2rem;
          object-fit: cover;
          margin: 0;
        }
      }
    }
  }
   ::before {
    position: fixed;
    content: "";
    box-shadow: 0 0 100px 40px #ffffff08;
    top: -10%;
    left: -100%;
    transform: rotate(-45deg);
    height: 60rem;
    transition: .7s all;
  }
  &:hover {
    border: 1px solid #ffffff44;
    box-shadow: 0 7px 50px 10px #000000aa;
    transform: scale(1.015);
    filter: brightness(1.3);
     ::before {
      filter: brightness(.5);
      top: -100%;
      left: 200%;
    }
  }
}

.bg {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  h1 {
    font-size: 20rem;
    filter: opacity(0.5);
  }
}
.buttons {
    margin: 10%;
    text-align: center;
}

.btn-hover {
    width: 200px;
    font-size: 16px;
    font-weight: 600;
    color: #fff;
    cursor: pointer;
    margin: 20px;
    height: 55px;
    text-align:center;
    border: none;
    background-size: 300% 100%;

    border-radius: 50px;
    moz-transition: all .4s ease-in-out;
    -o-transition: all .4s ease-in-out;
    -webkit-transition: all .4s ease-in-out;
    transition: all .4s ease-in-out;
}

.btn-hover:hover {
    background-position: 100% 0;
    moz-transition: all .4s ease-in-out;
    -o-transition: all .4s ease-in-out;
    -webkit-transition: all .4s ease-in-out;
    transition: all .4s ease-in-out;
}

.btn-hover:focus {
    outline: none;
}

.btn-hover.color-7 {
    background-image: linear-gradient(to right, #6253e1, #852D91, #A3A1FF, #F24645);
    box-shadow: 0 4px 15px 0 rgba(126, 52, 161, 0.75);
}
<div class="product-card-container">
  <div class="wrapper_div">
    <div class="nft"  onclick="addProd('11', products)" class="card" >
        <div class='main'>
          <img class='tokenImage' src="{{ url_for('static', filename='img/м1.jpg') }}" alt="NFT" />
          <h2>Набор</h2>
          <p class='description'></p>
          <div class='tokenInfo'>
            <div class="price">
              <ins>◘</ins>
              <p>499 Руб</p>
            </div>
          </div>
        </div>
     </div>
<button class="btn-hover color-7">BUTTON</button>
  </div>
  <div class="wrapper_div">
     <div class="nft" onclick="addProd('12', products)" class="card" >
        <div class='main'>
          <img class='tokenImage' src="{{ url_for('static', filename='img/м2.jpg') }}" alt="NFT" />
          <h2>Заяц</h2>
          <p class='description'></p>
          <div class='tokenInfo'>
            <div class="price">
              <ins>◘</ins>
              <p>179 Руб</p>
            </div>
          </div>
        </div>
     </div>
    <button class="btn-hover color-7">BUTTON</button>
   </div>
   <div class="wrapper_div">
     <div class="nft" onclick="addProd('13', products)" class="card" >
        <div class='main'>
          <img class='tokenImage' src="{{ url_for('static', filename='img/м3.jpg') }}" alt="NFT" />
          <h2>Массажка</h2>
          <p class='description'></p>
          <div class='tokenInfo'>
            <div class="price">
              <ins>◘</ins>
              <p>179 Руб</p>
            </div>
          </div>
        </div>
     </div>
<button class="btn-hover color-7">BUTTON</button>
</div>
 </div>
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading