Halo temen-temen, kembali lagi dengan saya. Konten pada artikel kali ini menyambung atau upgrade dari konten sebelumnya yaitu Container Card Block Animasi Keren Elegan menggunakan HTML dan CSS versi #1.

Pada versi #2 ini, berbeda dengan artikel sebelumnya, konten kali ini lebih ke desain card block yang responsive, friendly, modern, elegan pokoknya perfect temen-temen. Kode nya pun juga sangat simpel untuk memulai memahami cara kerja css responsive. Desain ini juga sudah mendukung di semua browser temen-temen.

Di sini untuk text editornya saya menggunakan Visual Studio Code serta Firefox sebagai browsernya.

Untuk temen-temen yang kepo tentang konfigurasi dan extensi VS Code yang saya pakai silakan klik sitasi di bawah ini.

Full Konfigurasi & Ekstensi VS Code Saya
Tampilan Card Block #2

Berikut untuk script lengkapnya dan jika ada yang belum jelas bisa menonton videonya di atas.

Source Assets Icons (2416632-internet-of-things) – https://www.flaticon.com/packs/internet-of-things-78

index.html

/index.html
<html lang="id">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta http-equiv="X-UA-Compatible" content="ie=edge" />
    <title>Desain Card Block Perfect Modern Responsive #2</title>
    <link rel="stylesheet" href="assets/css/style.css" />
  </head>
  <body>
    <div class="container">
      <div class="card">
        <div class="card-content card-header">
          <div class="content">
            <img
              src="assets/images/2416632-internet-of-things/svg/012-laptop.svg"
              alt=""
            />
            <h3>Laptop</h3>
          </div>
        </div>
        <div class="card-content card-body">
          <div class="content">
            <p>
              Lorem ipsum dolor sit amet consectetur, adipisicing elit. Tempore
              deserunt dolor impedit ratione quisquam nihil. Quisquam, aliquid?
              Nulla vero, voluptas veniam ab pariatur fugiat! Reiciendis
              possimus voluptatibus iusto magnam consequuntur?
            </p>
            <a href="#">Selengkapnya</a>
          </div>
        </div>
      </div>

      <div class="card">
        <div class="card-content card-header">
          <div class="content">
            <img
              src="assets/images/2416632-internet-of-things/svg/007-cloud.svg"
              alt=""
            />
            <h3>Cloud</h3>
          </div>
        </div>
        <div class="card-content card-body">
          <div class="content">
            <p>
              Lorem ipsum dolor sit amet consectetur adipisicing elit. Quibusdam
              quam sunt quo nemo tempore! Nostrum fuga praesentium nihil,
              aperiam recusandae ut alias voluptatibus pariatur labore dolore
              autem eos laborum quo?
            </p>
            <a href="#">Selengkapnya</a>
          </div>
        </div>
      </div>

      <div class="card">
        <div class="card-content card-header">
          <div class="content">
            <img
              src="assets/images/2416632-internet-of-things/svg/026-smartphone.svg"
              alt=""
            />
            <h3>Smart Phone</h3>
          </div>
        </div>
        <div class="card-content card-body">
          <div class="content">
            <p>
              Lorem ipsum dolor sit amet consectetur adipisicing elit.
              Dignissimos mollitia inventore voluptas eveniet nostrum facilis
              ab, aut et consequuntur praesentium, iusto obcaecati velit commodi
              soluta iure corporis omnis aspernatur nesciunt?
            </p>
            <a href="#">Selengkapnya</a>
          </div>
        </div>
      </div>
    </div>
  </body>
</html>

style.css

/assets/css/style.css
* {
  margin: 0;
  padding: 0;
}

body {
  background: url("../images/bg.jpg");
  background-position: top center;
  background-size: cover;
  min-height: 100vh;
  font-family: "Courier New", Courier, monospace;
}

.container {
  position: absolute;
  top: 50%;
  left: 50%;
  -webkit-transform: translate(-50%, -50%);
  transform: translate(-50%, -50%);
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
}

.card {
  position: relative;
}

.card > .card-content {
  width: 300px;
  height: 300px;
  -webkit-transition: 0.6s;
  transition: 0.6s;
}

.card > .card-content.card-header {
  position: relative;
  background: #212121;
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-pack: center;
  -ms-flex-pack: center;
  justify-content: center;
  -webkit-box-align: center;
  -ms-flex-align: center;
  align-items: center;
  z-index: 1;
  -webkit-transform: translateY(146px);
  transform: translateY(146px);
}

.card:hover > .card-content.card-header {
  -webkit-transform: translateY(0);
  transform: translateY(0);
}

.card:nth-child(1):hover > .card-content.card-header,
.card:nth-child(1) > .card-content.card-body,
.card:nth-child(1) > .card-content.card-body .content a:hover {
  background: #ff1744;
}

.card:nth-child(2):hover > .card-content.card-header,
.card:nth-child(2) > .card-content.card-body,
.card:nth-child(2) > .card-content.card-body .content a:hover {
  background: #64dd17;
}

.card:nth-child(3):hover > .card-content.card-header,
.card:nth-child(3) > .card-content.card-body,
.card:nth-child(3) > .card-content.card-body .content a:hover {
  background: #ffd600;
}

.card > .card-content.card-header .content {
  text-align: center;
  opacity: 0.3;
  -webkit-transition: 0.6s;
  transition: 0.6s;
}

.card:hover > .card-content.card-header .content {
  opacity: 1;
}

.card > .card-content.card-header img {
  -webkit-filter: brightness(0) invert(1);
  filter: brightness(0) invert(1);
  max-height: 120px;
}

.card > .card-content.card-header h3 {
  margin-top: 12px;
  font-size: 20px;
  color: #fff;
}

.card > .card-content.card-body {
  position: relative;
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-pack: center;
  -ms-flex-pack: center;
  justify-content: center;
  -webkit-box-align: center;
  -ms-flex-align: center;
  align-items: center;
  -webkit-transform: translateY(-146px);
  transform: translateY(-146px);
  font-size: 16px;
  padding: 20px;
  -webkit-box-sizing: border-box;
  box-sizing: border-box;
  color: #212121;
}

.card:hover > .card-content.card-body {
  background: #fff;
  -webkit-transform: translateY(0);
  transform: translateY(0);
}

.card > .card-content.card-body .content a {
  margin-top: 16px;
  padding: 6px;
  display: inline-block;
  font-size: 18px;
  font-weight: 400;
  text-decoration: none;
}

.card:nth-child(1) > .card-content.card-body .content a {
  color: #ff1744;
  border: 1px solid #ff1744;
}

.card:nth-child(2) > .card-content.card-body .content a {
  color: #64dd17;
  border: 1px solid #64dd17;
}

.card:nth-child(3) > .card-content.card-body .content a {
  color: #ffd600;
  border: 1px solid #ffd600;
}

.card > .card-content.card-body .content a:hover {
  color: #fff;
}

.card:nth-child(1) > .card-content {
  border-top-left-radius: 28px;
}

.card:nth-child(3) > .card-content {
  border-top-right-radius: 28px;
}

.card:nth-child(1) > .card-content.card-body {
  border-bottom-left-radius: 8px;
}

.card:nth-child(3) > .card-content.card-body {
  border-bottom-right-radius: 8px;
}

.card:nth-child(1):hover > .card-content,
.card:nth-child(3):hover > .card-content,
.card:nth-child(1):hover > .card-content.card-body,
.card:nth-child(3):hover > .card-content.card-body {
  border-radius: 0;
}

.card:hover > .card-content.card-header {
  border-top-left-radius: 20px;
  border-top-right-radius: 20px;
}

@media (min-width: 720px) and (max-width: 991px) {
  .card > .card-content {
    width: 230px;
    height: 230px;
  }

  .card > .card-content.card-header {
    -webkit-transform: translateY(111px);
    transform: translateY(111px);
  }

  .card > .card-content.card-header img {
    max-height: 96px;
  }

  .card > .card-content.card-header .content h3 {
    margin-top: 12px;
    font-size: 18px;
  }

  .card > .card-content.card-body {
    font-size: 12.4px;
    padding: 18px;
    -webkit-transform: translateY(-111px);
    transform: translateY(-111px);
  }

  .card > .card-content.card-body .content a {
    font-size: 14px;
  }

  .card:nth-child(1) > .card-content {
    border-top-left-radius: 20px;
  }

  .card:nth-child(3) > .card-content {
    border-top-right-radius: 20px;
  }

  .card:hover > .card-content.card-header {
    border-top-left-radius: 16px;
    border-top-right-radius: 16px;
  }
}

@media (min-width: 480px) and (max-width: 719px) {
  .card > .card-content {
    width: 150px;
    height: 150px;
  }

  .card > .card-content.card-header {
    -webkit-transform: translateY(71px);
    transform: translateY(71px);
  }

  .card > .card-content.card-header img {
    max-height: 72px;
  }

  .card > .card-content.card-header .content h3 {
    margin-top: 12px;
    font-size: 14px;
  }

  .card > .card-content.card-body {
    font-size: 8px;
    padding: 12px;
    -webkit-transform: translateY(-71px);
    transform: translateY(-71px);
  }

  .card > .card-content.card-body .content a {
    margin-top: 10px;
    font-size: 10px;
  }

  .card:nth-child(1) > .card-content {
    border-top-left-radius: 16px;
  }

  .card:nth-child(3) > .card-content {
    border-top-right-radius: 16px;
  }

  .card:hover > .card-content.card-header {
    border-top-left-radius: 12px;
    border-top-right-radius: 12px;
  }
}

@media (min-width: 320px) and (max-width: 479px) {
  .card > .card-content {
    width: 100px;
    height: 100px;
  }

  .card > .card-content.card-header {
    -webkit-transform: translateY(48px);
    transform: translateY(48px);
  }

  .card > .card-content.card-header img {
    max-height: 48px;
  }

  .card > .card-content.card-header .content h3 {
    margin-top: 10px;
    font-size: 10px;
  }

  .card > .card-content.card-body {
    font-size: 5.3px;
    padding: 8px;
    -webkit-transform: translateY(-48px);
    transform: translateY(-48px);
  }

  .card > .card-content.card-body .content a {
    margin-top: 6px;
    font-size: 8px;
  }

  .card:nth-child(1) > .card-content {
    border-top-left-radius: 12px;
  }

  .card:nth-child(3) > .card-content {
    border-top-right-radius: 12px;
  }

  .card:nth-child(1) > .card-content {
    border-bottom-left-radius: 4px;
  }

  .card:nth-child(3) > .card-content {
    border-bottom-right-radius: 4px;
  }

  .card:hover > .card-content.card-header {
    border-top-left-radius: 10px;
    border-top-right-radius: 10px;
  }
}

@media (max-width: 319px) {
  .card > .card-content {
    width: 72px;
    height: 72px;
  }

  .card > .card-content.card-header {
    -webkit-transform: translateY(34px);
    transform: translateY(34px);
  }

  .card > .card-content.card-header img {
    max-height: 36px;
  }

  .card > .card-content.card-header .content h3 {
    margin-top: 8px;
    font-size: 8px;
  }

  .card > .card-content.card-body {
    font-size: 4.2px;
    padding: 5px;
    -webkit-transform: translateY(-34px);
    transform: translateY(-34px);
  }

  .card > .card-content.card-body .content a {
    margin-top: 4px;
    font-size: 4px;
    padding: 4px;
  }

  .card:nth-child(1) > .card-content {
    border-top-left-radius: 10px;
  }

  .card:nth-child(3) > .card-content {
    border-top-right-radius: 10px;
  }

  .card:nth-child(1) > .card-content {
    border-bottom-left-radius: 4px;
  }

  .card:nth-child(3) > .card-content {
    border-bottom-right-radius: 4px;
  }

  .card:hover > .card-content.card-header {
    border-top-left-radius: 6px;
    border-top-right-radius: 6px;
  }
}

@media (max-width: 219px) {
  .container {
    display: block;
  }

  .card > .card-content {
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
  }

  .card > .card-content.card-body {
    border-bottom-left-radius: 4px;
    border-bottom-right-radius: 4px;
  }

  .card:hover > .card-content {
    border-radius: 0;
  }

  .card:hover > .card-content.card-header {
    border-top-left-radius: 6px;
    border-top-right-radius: 6px;
  }
}

Assets External

Semoga Bermanfaat …