CSS only Load More

by CheapSk8

HTML

<link href="https://fonts.googleapis.com/css2?family=Open+Sans:wght@600;800&family=Roboto:wght@500&display=swap" rel="stylesheet"> 

<div class="main">
<div class="card">
<h4>
Title
</h4>
<p>
Description here
</p>
<img src="https://via.placeholder.com/150x150" />
</div>
<div class="card">
<h4>
Title
</h4>
<p>
Description here
</p>
<img src="https://via.placeholder.com/150x150" />
</div>
<input type="checkbox" class="card-load-more-check" id="card-load-more-1" />
<label class="card-load-more" for="card-load-more-1">Load More</label>
<div class="card">
<h4>
Title
</h4>
<p>
Description here
</p>
<img src="https://via.placeholder.com/150x150" />
</div>
<div class="card">
<h4>
Title
</h4>
<p>
Description here
</p>
<img src="https://via.placeholder.com/150x150" />
</div>
<input type="checkbox" id="card-load-more-2" class="card-load-more-check" />
<label class="card-load-more" for="card-load-more-2">Load More</label>
<div class="card">
<h4>
Title
</h4>
<p>
Description here
</p>
<img src="https://via.placeholder.com/150x150" />
</div>
<div class="card">
<h4>
Title
</h4>
<p>
Description here
</p>
<img src="https://via.placeholder.com/150x150" />
</div>
<input type="checkbox" id="card-load-more-3" class="card-load-more-check" />
<label class="card-load-more" for="card-load-more-3">Load More</label>
<div class="card">
<h4>
Title
</h4>
<p>
Description here
</p>
<img src="https://via.placeholder.com/150x150" />
</div>
<div class="card">
<h4>
Title
</h4>
<p>
Description here
</p>
<img src="https://via.placeholder.com/150x150" />
</div>
<input type="checkbox" id="card-load-more-4" class="card-load-more-check" />
<label class="card-load-more" for="card-load-more-4">Load More</label>
<div class="card">
<h4>
Title
</h4>
<p>
Description here
</p>
<img src="https://via.placeholder.com/150x150" />
</div>
<div class="card">
<h4>
Title
</h4>
<p>
Description here
</p>
<img src="https://via.placeholder.com/150x150" />
</div>
</div>

CSS

.main {
  display: flex;
  max-width: 600px;
  flex-wrap: wrap;
  flex-direction: row;
  flex-grow: 0;
  border-color: #DE711F;
  border-width: 12px 8px 0 0;
  border-style: inset;
  padding: 0 20px;
  justify-content: space-around;
  margin-bottom: 50px;
  transition: all .3s ease-in;
}
.card {
  width: 200px;
  border: 3px solid #1f8cde;
  padding: 4px;
  margin-top: 24px;
}

.card h4 {
  color: #DE711F;
  text-transform: uppercase;
  font-family: 'Open Sans';
  font-weight: 800;
  box-sizing: border-box;
}

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

.card-load-more {
  display: block;
  position: relative;  
  width: 100%;
  flex-shrink: 0;
  text-align: center;
  line-height: 25px;
  padding: 10px 20px;
  border-radius: 20px;
  background-color: #1f8cde;
  color: #fff;
  font-family: Roboto;
  font-weight: 400;
  margin: 15px 8px 0;
  box-sizing: border-box;
  cursor: pointer;
}

.card-load-more-check,.card-load-more-check:checked + label {
  display: none;
}

.card-load-more-check:checked ~ .card {
  opacity: 1;
  overflow: hidden;
  transition: all .5s ease-in;
  max-height: 800px;
}

/*.card-load-more-check:checked ~ .card * {
  margin-top: 0;
  opacity: 1;
  transition: all .5s ease-in;
}*/

.card-load-more-check:not(:checked) ~ .card {
  position: absolute;
  z-index: -999;
  opacity: 0;
  max-height: 0;
}

/*.card-load-more-check:not(:checked) ~ .card * {
  margin-top: -100%;
  opacity: 0;
}*/

.card-load-more-check:not(:checked) + .card-load-more ~ .card-load-more{
  display: none;
}