box.css 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. .checkbox-box {
  2. display: inline-block;
  3. height: 20px;
  4. vertical-align: middle;
  5. width: 20px;
  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. }