<div class="container">
<div class="radio-tile-group">
<div class="input-container">
<input id="walk" class="radio-button" type="radio" name="radio">
<div class="radio-tile">
<div class="icon walk-icon">
<svg fill="#000000" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg">
<path d="M0 0h24v24H0z" fill="none"></path>
<path d="M13.5 5.5c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zM9.8 8.9L7 23h2.1l1.8-8 2.1 2v6h2v-7.5l-2.1-2 .6-3C14.8 12 16.8 13 19 13v-2c-1.9 0-3.5-1-4.3-2.4l-1-1.6c-.4-.6-1-1-1.7-1-.3 0-.5.1-.8.1L6 8.3V13h2V9.6l1.8-.7"></path>
</svg>
</div>
<label for="walk" class="radio-tile-label">Walk</label>
</div>
</div>
<div class="input-container">
<input id="bike" class="radio-button" type="radio" name="radio">
<div class="radio-tile">
<div class="icon bike-icon">
<svg fill="#000000" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg">
<path d="M0 0h24v24H0z" fill="none"></path>
<path d="M15.5 5.5c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zM5 12c-2.8 0-5 2.2-5 5s2.2 5 5 5 5-2.2 5-5-2.2-5-5-5zm0 8.5c-1.9 0-3.5-1.6-3.5-3.5s1.6-3.5 3.5-3.5 3.5 1.6 3.5 3.5-1.6 3.5-3.5 3.5zm5.8-10l2.4-2.4.8.8c1.3 1.3 3 2.1 5.1 2.1V9c-1.5 0-2.7-.6-3.6-1.5l-1.9-1.9c-.5-.4-1-.6-1.6-.6s-1.1.2-1.4.6L7.8 8.4c-.4.4-.6.9-.6 1.4 0 .6.2 1.1.6 1.4L11 14v5h2v-6.2l-2.2-2.3zM19 12c-2.8 0-5 2.2-5 5s2.2 5 5 5 5-2.2 5-5-2.2-5-5-5zm0 8.5c-1.9 0-3.5-1.6-3.5-3.5s1.6-3.5 3.5-3.5 3.5 1.6 3.5 3.5-1.6 3.5-3.5 3.5z"></path>
</svg>
</div>
<label for="bike" class="radio-tile-label">Bike</label>
</div>
</div>
<div class="input-container">
<input id="drive" class="radio-button" type="radio" name="radio">
<div class="radio-tile">
<div class="icon car-icon">
<svg fill="#000000" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg">
<path d="M18.92 6.01C18.72 5.42 18.16 5 17.5 5h-11c-.66 0-1.21.42-1.42 1.01L3 12v8c0 .55.45 1 1 1h1c.55 0 1-.45 1-1v-1h12v1c0 .55.45 1 1 1h1c.55 0 1-.45 1-1v-8l-2.08-5.99zM6.5 16c-.83 0-1.5-.67-1.5-1.5S5.67 13 6.5 13s1.5.67 1.5 1.5S7.33 16 6.5 16zm11 0c-.83 0-1.5-.67-1.5-1.5s.67-1.5 1.5-1.5 1.5.67 1.5 1.5-.67 1.5-1.5 1.5zM5 11l1.5-4.5h11L19 11H5z"></path>
<path d="M0 0h24v24H0z" fill="none"></path>
</svg>
</div>
<label for="drive" class="radio-tile-label">Drive</label>
</div>
</div>
</div>
</div>
*{
box-sizing:border-box;
margin:0;
padding:0;
}
body {
height:100vh;
display:flex;
align-items:center;
justify-content:center;
background-color: #e8e8e8;
font-family:arial;
}
.container {
display: flex;
justify-content: center;
align-items: center;
}
.radio-tile-group {
display: flex;
flex-wrap: wrap;
justify-content: center;
}
.radio-tile-group .input-container {
position: relative;
height: 80px;
width: 80px;
margin: 0.5rem;
}
.radio-tile-group .input-container .radio-button {
opacity: 0;
position: absolute;
top: 0;
left: 0;
height: 100%;
width: 100%;
margin: 0;
cursor: pointer;
}
.radio-tile-group .input-container .radio-tile {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
width: 100%;
height: 100%;
border: 2px solid #079ad9;
border-radius: 5px;
padding: 1rem;
transition: transform 300ms ease;
}
.radio-tile-group .input-container .icon svg {
fill: #079ad9;
width: 2rem;
height: 2rem;
}
.radio-tile-group .input-container .radio-tile-label {
text-align: center;
font-size: 0.75rem;
font-weight: 600;
text-transform: uppercase;
letter-spacing: 1px;
color: #079ad9;
}
.radio-tile-group .input-container .radio-button:checked + .radio-tile {
background-color: #079ad9;
border: 2px solid #079ad9;
color: white;
transform: scale(1.1, 1.1);
}
.radio-tile-group .input-container .radio-button:checked + .radio-tile .icon svg {
fill: white;
background-color: #079ad9;
}
.radio-tile-group .input-container .radio-button:checked + .radio-tile .radio-tile-label {
color: white;
background-color: #079ad9;
}
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.