box.css 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. .checkbox-box {
  2. display: inline-block;
  3. height: 20px;
  4. vertical-align: middle;
  5. width: 35px;
  6. }
  7. .checkbox-box input[type=checkbox] {
  8. max-height: 0;
  9. max-width: 0;
  10. opacity: 0;
  11. position: absolute;
  12. }
  13. .checkbox-box input[type=checkbox] + label {
  14. border-radius: 4px;
  15. border: 2px solid #212529;
  16. cursor: pointer;
  17. display: block;
  18. height: 20px;
  19. margin-bottom: 0;
  20. margin-top: 0;
  21. position: relative;
  22. text-indent: -5000px;
  23. width: 20px;
  24. }
  25. .checkbox-box input[type=checkbox] + label:before {
  26. border-color: #212529;
  27. border-style: solid;
  28. border-width: 0px 0px 2px 2px;
  29. content: "";
  30. display: block;
  31. height: 5px;
  32. left: 8px;
  33. opacity: 0;
  34. position: absolute;
  35. top: 7px;
  36. transform: translate3d(-50%, -50%, 0px) rotate(-45deg);
  37. transition: .1s ease-in-out;
  38. width: 7px;
  39. }
  40. .checkbox-box input[type=checkbox]:checked + label {
  41. border-color: #212529;
  42. }
  43. .checkbox-box input[type=checkbox]:focus + label {
  44. box-shadow: 0 0 0 0.25rem rgb(13 110 253 / 25%);
  45. outline: 0;
  46. }
  47. .checkbox-box input[type=checkbox]:hover + label:before {
  48. border-color: #212529;
  49. opacity: 0.5;
  50. }
  51. .checkbox-box input[type=checkbox]:checked + label:before {
  52. border-color: #212529;
  53. opacity: 1;
  54. }
  55. /* Blue */
  56. .checkbox-box.blue input[type=checkbox]:checked + label {
  57. border-color: #007bff;
  58. }
  59. .checkbox-box.blue input[type=checkbox]:focus + label {
  60. box-shadow: 0 0 0 0.25rem rgb(49 132 253 / 50%);
  61. }
  62. .checkbox-box.blue input[type=checkbox]:checked + label:before {
  63. border-color: #007bff;
  64. }
  65. /* Green */
  66. .checkbox-box.green input[type=checkbox]:checked + label {
  67. border-color: #28a745;
  68. }
  69. .checkbox-box.green input[type=checkbox]:focus + label {
  70. box-shadow: 0 0 0 0.25rem rgb(60 153 110 / 50%);
  71. }
  72. .checkbox-box.green input[type=checkbox]:checked + label:before {
  73. border-color: #28a745;
  74. }
  75. /* Red */
  76. .checkbox-box.red input[type=checkbox]:checked + label {
  77. border-color: #dc3545;
  78. }
  79. .checkbox-box.red input[type=checkbox]:focus + label {
  80. box-shadow: 0 0 0 0.25rem rgb(225 83 97 / 50%);
  81. }
  82. .checkbox-box.red input[type=checkbox]:checked + label:before {
  83. border-color: #dc3545;
  84. }
  85. /* White */
  86. .checkbox-box.white input[type=checkbox]:checked + label {
  87. border-color: #fff;
  88. }
  89. .checkbox-box.white input[type=checkbox]:focus + label {
  90. box-shadow: 0 0 0 0.25rem rgb(211 212 213 / 50%);
  91. }
  92. .checkbox-box.white input[type=checkbox]:checked + label:before {
  93. border-color: #fff;
  94. }