<html lang="en">
  <head>
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Image As Checkbox</title>
    <!-- Font Awesome Icons -->
    <link
      rel="stylesheet"
      href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css"
    />
    <!-- Stylesheet -->
    <link rel="stylesheet" href="style.css" />
  </head>
  <body>
    <div class="wrapper">
      <div class="container">
        <input type="checkbox" id="dessert-1" />
        <label for="dessert-1">
          <img src="https://i.postimg.cc/fSfKbf2C/dessert-01.png" />
        </label>
      </div>
      <div class="container">
        <input type="checkbox" id="dessert-2" />
        <label for="dessert-2">
          <img src="https://i.postimg.cc/LnvDKvZ6/dessert-02.png" />
        </label>
      </div>
      <div class="container">
        <input type="checkbox" id="dessert-3" />
        <label for="dessert-3">
          <img src="https://i.postimg.cc/875H1Whd/dessert-03.png" />
        </label>
      </div>
    </div>
  </body>
</html>
* {
  padding: 0;
  margin: 0;
  box-sizing: border-box;
}
body {
  background-color: #eef5ff;
}
.wrapper {
  width: 100%;
  position: absolute;
  transform: translate(-50%, -50%);
  top: 50%;
  left: 50%;
  display: grid;
  place-items: center;
  gap: 15px;
}
.container {
  height: 200px;
  width: 200px;
  background-color: #ffffff;
  box-shadow: 0 0 25px rgba(17, 1, 68, 0.08);
  border-radius: 8px;
  position: relative;
  cursor: pointer;
}
input[type="checkbox"] {
  -webkit-appearance: none;
  position: relative;
  width: 100%;
  cursor: pointer;
}
input[type="checkbox"]:after {
  position: absolute;
  font-family: "Font Awesome 5 Free";
  font-weight: 400;
  content: "\f111";
  font-size: 18px;
  color: #478bfb;
  right: 10px;
  top: -5px;
}
input[type="checkbox"]:checked:after {
  font-weight: 900;
  content: "\f058";
  color: #478bfb;
}
.container img {
  width: 70%;
  position: absolute;
  margin: auto;
  left: 0;
  right: 0;
  top: 0;
  bottom: 0;
  cursor: pointer;
}
@media screen and (min-width: 950px) {
  .wrapper {
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
  }
  .container {
    height: 300px;
    width: 300px;
  }
  input[type="checkbox"]:after {
    font-size: 22px;
  }
}

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.