<body>
<header class="hiThere">
<h1>A bunch of :radio buttons at your service.</h1>
<h3> // CSS only // – Please try out your options</h3>
<p>This was NOT possible without: <a href="https://codepen.io/ig_design/pen/dLNKgM?editors=1100">this resource!</a>
</header>
<div>
<p>Choose your tool</p>
<input class="checkbox-tools" type="radio" name="tools" id="eclipse">
<label for="eclipse">
Eclipse
</label>
<input class="checkbox-tools" type="radio" name="tools" id="square">
<label for="square">
square
</label>
<input class="checkbox-tools" type="radio" name="tools" id="box">
<label for="box">
box
</label>
</div>
</body>
body {
font-family: system, system-ui, BlinkMacSystemFont, "Segoe UI", Roboto,
"Helvetica Neue", Arial, sans-serif;
margin: 0;
padding: 0;
}
header {
background-color: #e0b38d;
position: relative;
top: 0;
box-shadow: 0 -3px 7px 1px rgba(49, 49, 49, 0.56);
padding: 50px;
margin-bottom: 40px;
}
div {
margin: 50px;
}
/* This hides the default radio buttons
[type="checkbox"]:checked,
[type="checkbox"]:not(:checked),
[type="radio"]:checked,
[type="radio"]:not(:checked){
position: absolute;
left: -9999px;
width: 0;
height: 0;
visibility: hidden;
}
*/
[type="radio"]:checked,
[type="radio"]:not(:checked) {
position: relative;
left: 14px;
z-index: 99;
}
.checkbox-tools:checked + label,
.checkbox-tools:not(:checked) + label {
position: relative;
display: inline-block;
padding: 20px 20px 20px 40px;
font-size: 14px;
letter-spacing: 1px;
text-align: left;
border-radius: 4px;
text-transform: uppercase;
color: black;
transition: box-shadow 150ms ease;
transition: box-shadow 150ms ease;
left: -20px;
}
.checkbox-tools:checked + label {
background-color: white;
border: 1px solid #333;
/* box-shadow: 0 8px 16px 0 rgba(0, 0, 0, 0.2); */
box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.2);
}
.checkbox-tools:not(:checked) + label {
background-color: white;
border: 1px solid transparent;
box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.2);
}
.checkbox-tools:not(:checked) + label:hover,
.checkbox-tools:checked + label:hover,
[type="radio"]:hover + label {
box-shadow: 0 8px 12px 0 rgba(0, 0, 0, 0.2);
cursor: pointer;
transition: box-shadow 300ms ease;
transition: box-shadow 300ms ease;
}
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.