.tabs
input(type="radio" name="name" checked)
.content
.title Pure CSS Color Tabs
input(type="radio" name="name")
.content
.title Pure CSS Color Tabs 2
input(type="radio" name="name")
.content
.title Pure CSS Color Tabs 3
input(type="radio" name="name")
.content
.title Pure CSS Color Tabs 4
View Compiled
$tab-color1: #f06868;
$tab-color2: #fab57a;
$tab-color3: #edf798;
$tab-color4: #80d6ff;
$tab-width: 24px;
.tabs {
height: 100vh;
position: relative;
overflow: hidden;
}
input[type="radio"] {
position: absolute;
left: 0;
width: $tab-width;
height: 25%;
outline: $tab-width/2 solid;
outline-offset: -$tab-width/2;
margin: 0;
padding: 0;
z-index: 1;
appearance: none;
cursor: pointer;
&:nth-of-type(1) { outline-color: $tab-color1; top: 0%;}
&:nth-of-type(2) { outline-color: $tab-color2; top: 25%;}
&:nth-of-type(3) { outline-color: $tab-color3; top: 50%;}
&:nth-of-type(4) { outline-color: $tab-color4; top: 75%;}
&:checked {
+ .content {
transform: translateX(0%);
transition: transform 0.4s ease 0.4s;
}
}
}
.content {
display: flex;
justify-content: center;
align-items: center;
flex-flow: column;
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
transition: transform 0.4s ease;
transform: translateX(-100%);
&:nth-of-type(1) { background-color: $tab-color1;}
&:nth-of-type(2) { background-color: $tab-color2;}
&:nth-of-type(3) { background-color: $tab-color3;}
&:nth-of-type(4) { background-color: $tab-color4;}
}
.title {
font-size: 5vw;
font-weight: bold;
color: #fff;
}
View Compiled
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.