A HTML and CSS code snippet post which shows you how to create a CSS and HTML mobile friendly responsive mosaic for images. Sourced under a permissive license. 

A CSS and HTML mobile friendly responsive mosaic for images

<div class="image-mosaic">
  <div
    class="card card-tall card-wide"
    style="background-image: url('https://codesnippetsandtutorials.com/wp-content/uploads/2023/07/swati-b-Vf2-ZiIu8xY-unsplash-1-840x400.jpg')"
  ></div>
  <div
    class="card card-tall"
    style="background-image: url('https://codesnippetsandtutorials.com/wp-content/uploads/2023/07/swati-b-Vf2-ZiIu8xY-unsplash-1-840x400.jpg')"
  ></div>
  <div
    class="card"
    style="background-image: url('https://codesnippetsandtutorials.com/wp-content/uploads/2023/07/swati-b-Vf2-ZiIu8xY-unsplash-1-840x400.jpg')"
  ></div>
  <div
    class="card"
    style="background-image: url('https://codesnippetsandtutorials.com/wp-content/uploads/2023/07/swati-b-Vf2-ZiIu8xY-unsplash-1-840x400.jpg')"
  ></div>
  <div
    class="card"
    style="background-image: url('https://codesnippetsandtutorials.com/wp-content/uploads/2023/07/swati-b-Vf2-ZiIu8xY-unsplash-1-840x400.jpg')"
  ></div>
  <div
    class="card"
    style="background-image: url('https://codesnippetsandtutorials.com/wp-content/uploads/2023/07/swati-b-Vf2-ZiIu8xY-unsplash-1-840x400.jpg')"
  ></div>
  <div
    class="card card-wide"
    style="background-image: url('https://codesnippetsandtutorials.com/wp-content/uploads/2023/07/swati-b-Vf2-ZiIu8xY-unsplash-1-840x400.jpg')"
  ></div>
  <div
    class="card"
    style="background-image: url('https://codesnippetsandtutorials.com/wp-content/uploads/2023/07/swati-b-Vf2-ZiIu8xY-unsplash-1-840x400.jpg')"
  ></div>
  <div
    class="card"
    style="background-image: url('https://codesnippetsandtutorials.com/wp-content/uploads/2023/07/swati-b-Vf2-ZiIu8xY-unsplash-1-840x400.jpg')"
  ></div>
  <div
    class="card"
    style="background-image: url('https://codesnippetsandtutorials.com/wp-content/uploads/2023/07/swati-b-Vf2-ZiIu8xY-unsplash-1-840x400.jpg')"
  ></div>
  <div
    class="card"
    style="background-image: url('https://codesnippetsandtutorials.com/wp-content/uploads/2023/07/swati-b-Vf2-ZiIu8xY-unsplash-1-840x400.jpg')"
  ></div>
  <div
    class="card"
    style="background-image: url('https://codesnippetsandtutorials.com/wp-content/uploads/2023/07/swati-b-Vf2-ZiIu8xY-unsplash-1-840x400.jpg')"
  ></div>
</div>
<style>
.image-mosaic {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  grid-auto-rows: 240px;
}

.card {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background: #353535;
  font-size: 3rem;
  color: #fff;
  box-shadow: rgba(3, 8, 20, 0.1) 0px 0.15rem 0.5rem, rgba(2, 8, 20, 0.1) 0px 0.075rem 0.175rem;
  height: 100%;
  width: 100%;
  border-radius: 4px;
  transition: all 500ms;
  overflow: hidden;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  padding: 0;
  margin: 0;
}

@media screen and (min-width: 600px) {
  .card-tall {
    grid-row: span 2 / auto;
  }

  .card-wide {
    grid-column: span 2 / auto;
  }
}
</style>

Tags: CSS, HTML, mobile friendly, responsive mosaic, images, image mosaic, css snippets, css code snippets, html code snippets

Image: Unsplash license 

CC BY 4.0 added intro and tags – 30 Seconds of Code