checkbix.css 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233
  1. input[type='checkbox'].checkbix {
  2. position: absolute;
  3. opacity: 0;
  4. z-index: -1;
  5. }
  6. input[type='checkbox'].checkbix + label {
  7. position: relative;
  8. display: -webkit-inline-box;
  9. display: -ms-inline-flexbox;
  10. display: inline-flex;
  11. -webkit-box-align: center;
  12. -ms-flex-align: center;
  13. align-items: center;
  14. color: inherit;
  15. -webkit-transition: all 250ms cubic-bezier(.4,.0,.23,1);
  16. transition: all 250ms cubic-bezier(.4,.0,.23,1);
  17. margin-bottom: .15rem;
  18. }
  19. input[type='checkbox'].checkbix + label > span {
  20. display: -webkit-box;
  21. display: -ms-flexbox;
  22. display: flex;
  23. -webkit-box-pack: center;
  24. -ms-flex-pack: center;
  25. justify-content: center;
  26. -webkit-box-align: center;
  27. -ms-flex-align: center;
  28. align-items: center;
  29. margin-right: .5em;
  30. width: 16px;
  31. height: 16px;
  32. background: transparent;
  33. border: .1rem solid #333;
  34. border-radius: 1px;
  35. cursor: pointer;
  36. -webkit-transition: all 250ms cubic-bezier(.4,.0,.23,1);
  37. transition: all 250ms cubic-bezier(.4,.0,.23,1);
  38. position: relative;
  39. }
  40. input[type='checkbox'].checkbix:focus + label > span {
  41. outline: 0;
  42. border-color: rgb(0,20,20);
  43. box-shadow: 0 0 0 1px rgba(0,20,20,.5);
  44. }
  45. input[type='checkbox'].checkbix:checked + label > span {
  46. background: #5ECD62;
  47. border: .1rem solid transparent;
  48. -webkit-animation: reveal 200ms cubic-bezier(.4,.0,.5,1);
  49. animation: reveal 200ms cubic-bezier(.4,.0,.5,1);
  50. }
  51. input[type='checkbox'].checkbix:checked + label > span:before {
  52. content: "";
  53. position: absolute;
  54. top: 0;
  55. left: 22%;
  56. margin-left: auto;
  57. margin-right: auto;
  58. border-right: 2px solid transparent;
  59. border-bottom: 2px solid transparent;
  60. -webkit-transform: rotate(45deg);
  61. transform: rotate(45deg);
  62. -webkit-transform-origin: 0% 100%;
  63. transform-origin: 0% 100%;
  64. -webkit-animation: checkboxcheck 125ms 50ms cubic-bezier(.1,.0,.1,1) forwards;
  65. animation: checkboxcheck 125ms 50ms cubic-bezier(.1,.0,.1,1) forwards;
  66. }
  67. @-webkit-keyframes reveal{
  68. 0%{
  69. -webkit-transform: scale(1);
  70. transform: scale(1);
  71. }
  72. 33%{
  73. -webkit-transform: scale(.5);
  74. transform: scale(.5);
  75. }
  76. 100%{
  77. -webkit-transform: scale(1);
  78. transform: scale(1);
  79. }
  80. }
  81. @keyframes reveal{
  82. 0%{
  83. -webkit-transform: scale(1);
  84. transform: scale(1);
  85. }
  86. 33%{
  87. -webkit-transform: scale(.5);
  88. transform: scale(.5);
  89. }
  90. 100%{
  91. -webkit-transform: scale(1);
  92. transform: scale(1);
  93. }
  94. }
  95. @-webkit-keyframes checkboxcheck {
  96. 0%{
  97. width: 0;
  98. height: 0;
  99. border-color: white;
  100. -webkit-transform: rotate(45deg);
  101. transform: rotate(45deg);
  102. }
  103. 33%{
  104. width: .2em;
  105. height: .3em;
  106. -webkit-transform: rotate(45deg);
  107. transform: rotate(45deg);
  108. }
  109. 100%{
  110. width: .2em;
  111. height: .4em;
  112. border-color: white;
  113. -webkit-transform: rotate(45deg);
  114. transform: rotate(45deg);
  115. }
  116. }
  117. @keyframes checkboxcheck {
  118. 0%{
  119. width: 0;
  120. height: 0;
  121. border-color: white;
  122. -webkit-transform: rotate(45deg);
  123. transform: rotate(45deg);
  124. }
  125. 33%{
  126. width: .2em;
  127. height: .3em;
  128. -webkit-transform: rotate(45deg);
  129. transform: rotate(45deg);
  130. }
  131. 100%{
  132. width: .2em;
  133. height: .4em;
  134. border-color: white;
  135. -webkit-transform: rotate(45deg);
  136. transform: rotate(45deg);
  137. }
  138. }
  139. /* Size */
  140. input[type='checkbox'].checkbix[data-size='large'] + label > span {
  141. width: 24px;
  142. height: 24px;
  143. }
  144. input[type='checkbox'].checkbix[data-size='large'] + label > span:before {
  145. -webkit-animation: checkboxchecklarge 125ms 50ms cubic-bezier(.1,.0,.1,1) forwards;
  146. animation: checkboxchecklarge 125ms 50ms cubic-bezier(.1,.0,.1,1) forwards;
  147. border-right: 3px solid transparent;
  148. border-bottom: 3px solid transparent;
  149. }
  150. @-webkit-keyframes checkboxchecklarge {
  151. 0%{
  152. width: 0;
  153. height: 0;
  154. border-color: white;
  155. -webkit-transform: rotate(45deg);
  156. transform: rotate(45deg);
  157. }
  158. 33%{
  159. width: .3em;
  160. height: .6em;
  161. -webkit-transform: rotate(45deg);
  162. transform: rotate(45deg);
  163. }
  164. 100%{
  165. width: .3em;
  166. height: .6em;
  167. border-color: white;
  168. -webkit-transform: rotate(45deg);
  169. transform: rotate(45deg);
  170. }
  171. }
  172. @keyframes checkboxchecklarge {
  173. 0%{
  174. width: 0;
  175. height: 0;
  176. border-color: white;
  177. -webkit-transform: rotate(45deg);
  178. transform: rotate(45deg);
  179. }
  180. 33%{
  181. width: .3em;
  182. height: .6em;
  183. -webkit-transform: rotate(45deg);
  184. transform: rotate(45deg);
  185. }
  186. 100%{
  187. width: .3em;
  188. height: .6em;
  189. border-color: white;
  190. -webkit-transform: rotate(45deg);
  191. transform: rotate(45deg);
  192. }
  193. }
  194. /* Shape */
  195. input[type='checkbox'].checkbix[data-shape='circled'] + label > span {
  196. border-radius: 100%;
  197. }
  198. /* Colors */
  199. input[type='checkbox'].checkbix[data-color='black']:checked + label > span {
  200. background: #111;
  201. }
  202. input[type='checkbox'].checkbix[data-color='blue']:checked + label > span {
  203. background: #0074D9;
  204. }
  205. input[type='checkbox'].checkbix[data-color='red']:checked + label > span {
  206. background: #FF4136;
  207. }
  208. input[type='checkbox'].checkbix[data-color='gray']:checked + label > span {
  209. background: #AAAAAA;
  210. }
  211. input[type='checkbox'].checkbix[data-color='orange']:checked + label > span {
  212. background: #FF851B;
  213. }