<div class="tabs" >
<div class="tabs-tab">
<input id="id-01" type="radio" name="tab-btn" checked value="value_01">
<label for="id-01">
<img src="https://demiart.ru/forum/journal_uploads15/j1393929_1684771400_0.png" class="icon"> Popular slots
</label>
</div>
<div class="tabs-tab">
<input id="id-02" type="radio" name="tab-btn" value="value_02">
<label for="id-02">
<img src="https://demiart.ru/forum/journal_uploads15/j1393929_1684771400_0.png" class="icon">New slots
</label>
</div>
<div class="tabs-tab">
<input id="id-03" type="radio" name="tab-btn" value="value_03">
<label for="id-03">
<img src="https://demiart.ru/forum/journal_uploads15/j1393929_1684771400_0.png" class="icon"> Instant games
</label>
</div>
<div class="tabs-tab">
<input id="id-04" type="radio" name="tab-btn" value="value_04">
<label for="id-04">
<img src="https://demiart.ru/forum/journal_uploads15/j1393929_1684771400_0.png" class="icon"> Jackpot games
</label>
</div>
<div class="tabs-tab">
<input id="id-05" type="radio" name="tab-btn" value="value_05">
<label for="id-05">
<img src="https://demiart.ru/forum/journal_uploads15/j1393929_1684771400_0.png" class="icon"> Bonus buy slots
</label>
</div>
<div class="tabs-tab">
<input id="id-06" type="radio" name="tab-btn" value="value_06">
<label for="id-06">
<img src="https://demiart.ru/forum/journal_uploads15/j1393929_1684771400_0.png" class="icon">Megaways
</label>
</div>
</div>
<p id="out"></p>
*,
*::before,
*::after {
box-sizing: border-box;
}
.tabs {
display: flex;
flex-direction: row;
flex-wrap: wrap;
padding-top: 10px;
background-color: #ccc;
}
.tabs-tab input[type="radio"] {
display: none;
}
.tabs-tab input[type="radio"] + label {
background-color: #ccc;
}
.tabs-tab input[type="radio"]:checked + label {
background-color: #fff;
}
.tabs-tab label {
white-space: nowrap;
min-width: 165px;
display: flex;
flex-direction: row;
align-items: center;
justify-content: flex-start;
border-radius: 22px;
box-shadow: 0 0 2px black;
padding: 5px 10px;
margin-left: 10px;
margin-right: 10px;
margin-bottom: 10px;
cursor: pointer;
user-select: none;
}
document.addEventListener('change', function(e){
e.preventDefault();
let _this = e.target;
let _name = _this.name;
let out = document.getElementById('out');
out.innerHTML = document.querySelector(`input[name="${_name}"]:checked`).value;
/**
* В форме данные передаются по другому
**/
});
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.