Advertisement
Guest User

Untitled

a guest
Feb 23rd, 2019
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.58 KB | None | 0 0
  1. <html>
  2. <head>
  3. <title>Slider Switch<style id="jsbin-css">
  4. *{
  5. box-sizing: border-box;
  6. }
  7.  
  8. .SliderSwitch {
  9. text-align: center;
  10. }
  11.  
  12. .SliderSwitch input{
  13. visibility: hidden;
  14. display: block;
  15. width: 1px;
  16. height: 1px;
  17. }
  18.  
  19. .SliderSwitch__container{
  20. font-family: 'OpenSans';
  21. font-size: 13px;
  22. color: #fff;
  23. background-color: #824fa0;
  24. height: 32px;
  25. display: inline-block;
  26. width: 240px;
  27. border-radius: 16px;
  28. position: relative;
  29. vertical-align: middle;
  30. box-shadow: inset 0px 0px 3px 1px rgba(0,0,0,0.3);
  31. cursor: pointer;
  32. margin-left: 10px;
  33. }
  34. .SliderSwitch__container:before {
  35. content: 'Sounds';
  36. display: block;
  37. position: absolute;
  38. top: 50%;
  39. margin-top: -8px;
  40. width: 50%;
  41. text-align: center;
  42. }
  43. .SliderSwitch__container_second:after {
  44. content: 'Spelling';
  45. display: block;
  46. position: absolute;
  47. top: 50%;
  48. margin-top: -8px;
  49. width: 150%;
  50. text-align: center;
  51. }
  52.  
  53. .SliderSwitch__toggle {
  54. display: block;
  55. height: 32px;
  56. width: 120px;
  57. border-radius: 16px;
  58. background-color: white;
  59. border: 2px solid #824fa0;
  60. position: absolute;
  61. top: 0px;
  62. left: 0px;
  63. box-shadow: 0px 0px 3px rgba(0,0,0,0.2);
  64. cursor: pointer;
  65. transition: left 300ms ease-in-out;
  66. }
  67.  
  68. .SliderSwitch__toggle:after {
  69. content: 'Sounds';
  70. font-family: 'OpenSans';
  71. font-size: 13px;
  72. color: #824fa0;
  73. display: block;
  74. position: absolute;
  75. top: 50%;
  76. margin-top: -8px;
  77. left: 0;
  78. width: 100%;
  79. text-align: center;
  80. }
  81.  
  82.  
  83. input:checked + .SliderSwitch__container .SliderSwitch__toggle {
  84. left: calc( 50% );
  85.  
  86. }
  87.  
  88. input:checked + .SliderSwitch__container .SliderSwitch__toggle:after {
  89. content: 'Spelling';
  90. color: #824fa0;
  91. }
  92. </style>
  93. </title>
  94. <body>
  95. <div class="SliderSwitch">
  96. <label for="switch">
  97. <input id="switch" type="checkbox" />
  98. <div class="SliderSwitch__container">
  99. <div class="SliderSwitch__container_second"></div>
  100. <div class="SliderSwitch__toggle">
  101. </div>
  102.  
  103. </div>
  104. </label>
  105. </div>
  106.  
  107.  
  108. <script id="jsbin-source-css" type="text/css">*{
  109. box-sizing: border-box;
  110. }
  111.  
  112. .SliderSwitch {
  113. text-align: center;
  114. }
  115.  
  116. .SliderSwitch input{
  117. visibility: hidden;
  118. display: block;
  119. width: 1px;
  120. height: 1px;
  121. }
  122.  
  123. .SliderSwitch__container{
  124. font-family: 'OpenSans';
  125. font-size: 13px;
  126. color: #fff;
  127. background-color: #824fa0;
  128. height: 32px;
  129. display: inline-block;
  130. width: 240px;
  131. border-radius: 16px;
  132. position: relative;
  133. vertical-align: middle;
  134. box-shadow: inset 0px 0px 3px 1px rgba(0,0,0,0.3);
  135. cursor: pointer;
  136. margin-left: 10px;
  137. }
  138. .SliderSwitch__container:before {
  139. content: 'Sounds';
  140. display: block;
  141. position: absolute;
  142. top: 50%;
  143. margin-top: -8px;
  144. width: 50%;
  145. text-align: center;
  146. }
  147. .SliderSwitch__container_second:after {
  148. content: 'Spelling';
  149. display: block;
  150. position: absolute;
  151. top: 50%;
  152. margin-top: -8px;
  153. width: 150%;
  154. text-align: center;
  155. }
  156.  
  157. .SliderSwitch__toggle {
  158. display: block;
  159. height: 32px;
  160. width: 120px;
  161. border-radius: 16px;
  162. background-color: white;
  163. border: 2px solid #824fa0;
  164. position: absolute;
  165. top: 0px;
  166. left: 0px;
  167. box-shadow: 0px 0px 3px rgba(0,0,0,0.2);
  168. cursor: pointer;
  169. transition: left 300ms ease-in-out;
  170. }
  171.  
  172. .SliderSwitch__toggle:after {
  173. content: 'Sounds';
  174. font-family: 'OpenSans';
  175. font-size: 13px;
  176. color: #824fa0;
  177. display: block;
  178. position: absolute;
  179. top: 50%;
  180. margin-top: -8px;
  181. left: 0;
  182. width: 100%;
  183. text-align: center;
  184. }
  185.  
  186.  
  187. input:checked + .SliderSwitch__container .SliderSwitch__toggle {
  188. left: calc( 50% );
  189.  
  190. }
  191.  
  192. input:checked + .SliderSwitch__container .SliderSwitch__toggle:after {
  193. content: 'Spelling';
  194. color: #824fa0;
  195. }</script>
  196. </body>
  197. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement