popup.html 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8" />
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  6. <title>Document</title>
  7. <style>
  8. .switch-an {
  9. position: absolute;
  10. clip: rect(0, 0, 0, 0);
  11. }
  12. .switch-an[type="checkbox"] + label {
  13. position: relative;
  14. display: inline-block;
  15. width: 60px;
  16. height: 26px;
  17. border-radius: 1em;
  18. color: #fff;
  19. background: #a5a5a5;
  20. text-align: left;
  21. font-size: 15px;
  22. cursor: pointer;
  23. }
  24. .switch-an[type="checkbox"] + label::before {
  25. content: "";
  26. width: 24px;
  27. height: 24px;
  28. top: 1px;
  29. position: absolute;
  30. left: 2px;
  31. border-radius: 100%;
  32. vertical-align: middle;
  33. background-color: #fff;
  34. transition: left 0.2s;
  35. }
  36. .switch-an[type="checkbox"] + label::after {
  37. content: "";
  38. margin-left: 37px;
  39. position: relative;
  40. top: 2px;
  41. }
  42. .switch-an[type="checkbox"]:checked + label {
  43. background-color: #06c;
  44. }
  45. .switch-an[type="checkbox"]:checked + label::before {
  46. transition: left 0.2s;
  47. left: 34px;
  48. }
  49. .switch-an[type="checkbox"]:checked + label::after {
  50. content: "";
  51. margin-left: 11px;
  52. }
  53. </style>
  54. </head>
  55. <body>
  56. <div class="check-wrap">
  57. <input type="checkbox" class="switch-an" id="highlight-switch" />
  58. <label for="highlight-switch"></label>
  59. </div>
  60. <!-- <button id="highlight-button">选择元素并高亮</button> -->
  61. <script src="popup.js"></script>
  62. </body>
  63. </html>