How to create: column cards

Learn how to create responsive column cards with CSS.

Try it yourself

How to create column cards

Step 1 - Add HTML:

<div class="row">
  <div class="column">
    <div class="card">..</div>
  </div>
  <div class="column">
    <div class="card">..</div>
  </div>
  <div class="column">
    <div class="card">..</div>
  </div>
  <div class="column">
    <div class="card">..</div>
  </div>
</div>

Step 2 - Add CSS:

* {
  box-sizing: border-box;
}
body {
  font-family: Arial, Helvetica, sans-serif;
}
/* Float four columns side by side */
.column {
  float: left;
  width: 25%;
  padding: 0 10px;
}
/* Remove extra left and right margins caused by the padding of the columns */
.row {margin: 0 -5px;}
/* Clear the float after the columns */
.row:after {
  content: "";
  display: table;
  clear: both;
}
/* Set the style of counter card */
.card {
  box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2); /* This adds the 'card' effect */
  padding: 16px;
  text-align: center;
  background-color: #f1f1f1;
}
/* Responsive column - Use single column layout (vertical) on small screens */
@media screen and (max-width: 600px) {
  .column {
    width: 100%;
    display: block;
    margin-bottom: 20px;
  }
}

Try it yourself

Related Pages

Tutorial:CSS Website Layout

Tutorial:CSS Responsive Web Design