Skip to content

Instantly share code, notes, and snippets.

@ktokot
Last active February 17, 2021 16:24
Show Gist options
  • Save ktokot/53e50932bcee59a02dea4fee24ab01c6 to your computer and use it in GitHub Desktop.
Save ktokot/53e50932bcee59a02dea4fee24ab01c6 to your computer and use it in GitHub Desktop.
Untitled
.ios-toggle {
box-sizing: border-box;
display: inline-block;
font-size: 15px;
width: 15em;
}
.ios-toggle input,
.ios-toggle input:active {
border: 0;
height: 0;
opacity: 0;
outline: none;
position: relative;
width: 0;
content: "Картинками"
}
.ios-toggle label {
background: #f8f8f8;
border: 0.2em solid #ddd;
border-radius: 2em;
box-sizing: border-box;
cursor: pointer;
display: block;
height: 3em;
padding: 2em;
position: relative;
transition: 0.3s ease-out;
width: 100%;
}
.ios-toggle label::before {
background: #ffffff;
border-radius: 2em;
box-shadow: 0 0.3em 0.3em rgba(0, 0, 0, 0.2), 0 0 0 0.1em #ddd;
content: "";
display: block;
height: 4em;
left: 0;
position: absolute;
right: auto;
text-indent: 4em;
top: 0;
transition: 0.25s ease-in-out;
width: 2.8em;
z-index: 2;
}
.ios-toggle label::after {
background: #f8f8f8;
border-radius: 1.4em;
content: "";
display: block;
height: 100%;
left: 0;
position: relative;
top: 0;
transition: 0.25s ease-in-out;
width: 2.8em;
z-index: 1;
padding: 0 2.2em;
content: "Списком"
}
.ios-toggle input:active + label::before {
width: 3.2em;
}
.ios-toggle input:checked + label {
border-color: #13bf11;
box-shadow: inset 0 0 0 2em #13bf11;
}
.ios-toggle input:checked + label::after {
background-color: #13bf11;
right: 1.4em;
width: 100%;
content: "Картинками"
}
.ios-toggle input:checked + label::before {
box-shadow: 0 0 0 0.1em transparent, 0 0.3em 0.3em rgba(0, 0, 0, 0.3);
left: calc(100% - 2.9em);
}
.ios-toggle input:checked:active + label::before {
left: calc(100% - 3.2em);
}
.ios-toggle input::checked ~ .main-wrapper .content {
display: none;
}
<div class="ios-toggle">
<input type="checkbox" id="ios-toggle" /><label for="ios-toggle" />
</div>
<div class="main-wrapper">
<div class="content">
<h1>A Style Switcher with Pure CSS!</h1>
<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium
quis, sem. Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo. Nullam dictum felis eu pede mollis pretium. Integer tincidunt. Cras dapibus.
Vivamus elementum semper nisi. Aenean vulputate eleifend tellus. Aenean leo ligula, porttitor eu, consequat vitae, eleifend ac, enim. Aliquam lorem ante, dapibus in, viverra quis, feugiat a, tellus.
</p>
</div>
</div>
// alert('Hello world!');
{"view":"split-vertical","fontsize":"100","seethrough":"","prefixfree":"","page":"all"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment