onoffswitch.css 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. /* On/Off FlipSwitch https://proto.io/freebies/onoff/ */
  2. .onoffswitch {
  3. position: relative;
  4. margin: 1ex 0;
  5. -moz-user-select: none;
  6. user-select: none;
  7. }
  8. .onoffswitch input {
  9. -webkit-appearance: none;
  10. -moz-appearance: none;
  11. cursor: pointer;
  12. position: absolute;
  13. top: -8px;
  14. bottom: -10px;
  15. left: -10px;
  16. width: calc(100% + 12px);
  17. border: 0;
  18. }
  19. #message-box .onoffswitch input {
  20. top: -6px;
  21. left: -6px;
  22. bottom: 0;
  23. height: calc(100% + 12px);
  24. }
  25. .onoffswitch span {
  26. display: block;
  27. overflow: hidden;
  28. height: 12px;
  29. padding: 0;
  30. line-height: 12px;
  31. border: 0 solid #E3E3E3;
  32. border-radius: 12px;
  33. background-color: #E0E0E0;
  34. box-shadow: inset 2px 2px 4px rgba(0,0,0,0.1);
  35. pointer-events: none; /* this is just a non-clickable decoration, only `input` is clickable */
  36. }
  37. .onoffswitch span::before {
  38. content: "";
  39. display: block;
  40. width: 18px;
  41. height: 18px;
  42. margin: -3px;
  43. background: #efefef;
  44. position: absolute;
  45. top: 0;
  46. bottom: 0;
  47. right: 46px;
  48. border-radius: 18px;
  49. box-shadow: 0 3px 13px 0 rgba(0, 0, 0, 0.4);
  50. }
  51. .onoffswitch input:checked + span {
  52. background-color: #CAEBE3;
  53. }
  54. .onoffswitch input:checked + span, .onoffswitch input:checked + span::before {
  55. border-color: #CAEBE3;
  56. }
  57. .onoffswitch input:checked + span .onoffswitch-inner {
  58. margin-left: 0;
  59. }
  60. .onoffswitch input:checked + span::before {
  61. right: 0;
  62. background-color: #04BA9F;
  63. box-shadow: 3px 6px 18px 0 rgba(0, 0, 0, 0.2);
  64. }