<input type="radio" name="name" checked="checked"/>
<div class="cp_item"><div class="inner">First Tab</div></div>
<input type="radio" name="name"/>
<div class="cp_item"><div class="inner">Second Tab</div></div>
<input type="radio" name="name"/>
<div class="cp_item"><div class="inner">Third Tab</div></div>
<input type="radio" name="name"/>
<div class="cp_item"><div class="inner">Force Tab</div></div>
html, body {
height: 100%;
position: relative;
overflow: hidden;
margin: 0;
padding: 0;
}
.cp_item .inner {
position: absolute;
top: 50%;
left: 50%;
-webkit-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
text-shadow: 0 1px 1px rgba(0, 0, 0, 0.1);
line-height: 1.2;
color: #fff;
z-index: 2;
}
.cp_item {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
-webkit-transition: -webkit-transform 0.4s ease;
transition: -webkit-transform 0.4s ease;
transition: transform 0.4s ease;
transition: transform 0.4s ease, -webkit-transform 0.4s ease;
-webkit-transform: translateX(-100%);
transform: translateX(-100%);
}
.cp_item:nth-of-type(1) {
background-color: #F06292;
}
.cp_item:nth-of-type(2) {
background-color: #FFB74D;
}
.cp_item:nth-of-type(3) {
background-color: #81C784;
}
.cp_item:nth-of-type(4) {
background-color: #26C6DA;
}
input[type="radio"] {
position: absolute;
left: 0;
width: 2em;
height: 25%;
outline: 2em solid;
outline-offset: -2em;
margin: 0;
z-index: 1;
cursor: pointer;
}
input[type="radio"]:nth-of-type(1) {
outline-color: #F06292;
top: 0%;
}
input[type="radio"]:nth-of-type(2) {
outline-color: #FFB74D;
top: 25%;
}
input[type="radio"]:nth-of-type(3) {
outline-color: #81C784;
top: 50%;
}
input[type="radio"]:nth-of-type(4) {
outline-color: #26C6DA;
top: 75%;
}
input[type="radio"]:checked + .cp_item {
-webkit-transform: translateX(0%);
transform: translateX(0%);
-webkit-transition: -webkit-transform 0.4s ease 0.4s;
transition: -webkit-transform 0.4s ease 0.4s;
transition: transform 0.4s ease 0.4s;
transition: transform 0.4s ease 0.4s, -webkit-transform 0.4s ease 0.4s;
}