<div class="products">
  <input class="sort-radio" type="radio" name="sort-radio" id="app"/>
  <input class="sort-radio" type="radio" name="sort-radio" id="game"/>
  <input class="sort-radio" type="radio" name="sort-radio" id="service"/>
  <div class="products__sort">
    <label class="button" for="app">app</label>
    <label class="button" for="game">game</label>
    <label class="button" for="service">service</label>
  </div>
  <div class="products__wrap">
    <div class="product" data-product-type="app">app</div>
    <div class="product" data-product-type="app">app</div>
    <div class="product" data-product-type="game">game</div>
    <div class="product" data-product-type="service">service</div>
    <div class="product" data-product-type="game">game</div>
    <div class="product" data-product-type="app">app</div>
    <div class="product" data-product-type="game">game</div>
    <div class="product" data-product-type="service">service</div>
    <div class="product" data-product-type="game">game</div>
    <div class="product" data-product-type="service">service</div>
    <div class="product" data-product-type="app">app</div>
    <div class="product" data-product-type="app">app</div>
    <div class="product" data-product-type="game">game</div>
    <div class="product" data-product-type="service">service</div>
    <div class="product" data-product-type="game">game</div>
    <div class="product" data-product-type="game">game</div>
  </div>
</div>

body {
  padding: 20px;
  background: #F5F5F5;
 width:50%;
  margin:auto;
}

.products__sort {
  
  display: flex;
  flex-flow: wrap;
}
.products__sort .button {
  padding: 12px 24px;
  margin: 0 12px 12px 0;
  border: none;
  border-radius: 6px;
  background-color: #00BCD4;
  color: #fff;
  cursor: pointer;
}
.products__sort .button:hover {
  background-color: #007888;
}
.products__wrap {
  display: flex;
  flex-flow: wrap;
  margin: 25px 0 0;
}
.products__wrap .product {
  width: 100%;
  padding: 5px;
  margin: 0 5px 5px 0;
  border: none;
  border-radius: 6px;
  background-color: rgba(0, 188, 212, 0.5);
  color: #007888;
}
.products .sort-radio {
  display: none;
}
.products .sort-radio[id="app"]:checked ~ .products__wrap .product[data-product-type="app"] {
  order: -1;
  background-color: #007888;
  color: #fff;
}
.products .sort-radio[id="app"]:checked ~ .products__sort .button[for="app"] {
  background-color: #007888;
}
.products .sort-radio[id="game"]:checked ~ .products__wrap .product[data-product-type="game"] {
  order: -1;
  background-color: #007888;
  color: #fff;
}
.products .sort-radio[id="game"]:checked ~ .products__sort .button[for="game"] {
  background-color: #007888;
}
.products .sort-radio[id="service"]:checked ~ .products__wrap .product[data-product-type="service"] {
  order: -1;
  background-color: #007888;
  color: #fff;
}
.products .sort-radio[id="service"]:checked ~ .products__sort .button[for="service"] {
  background-color: #007888;
}

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.