当前位置:   article > 正文

css实现更改checkbox的样式;更改checkbox选中后的背景色;更改checkbox选中后的icon_css checkbox 选中的颜色

css checkbox 选中的颜色

<input class="check-input" type="checkbox">
  1. .check-input {
  2. width: 16px;
  3. height: 16px;
  4. }
  5. /* 设置默认的checkbox样式 */
  6. input.check-input[type="checkbox"] {
  7. -webkit-appearance: none; /* 移除默认样式 */
  8. border: 1px solid #999;
  9. outline: none;
  10. border-radius: 2px;
  11. border: 1px solid #4C4E4F;
  12. background: #FFF;
  13. position: relative;
  14. }
  15. /* 设置选中状态下的checkbox样式 */
  16. input.check-input[type="checkbox"]:checked {
  17. background-color: red; /* 你可以更改这个颜色为你想要的颜色 */
  18. }
  19. /* 显示对勾 */
  20. #europe-collection-list input.check-input[type="checkbox"]:checked::after {
  21. content: "";
  22. display: block;
  23. width: 15px;
  24. height: 15px;
  25. position: absolute;
  26. background-image: url('https://files/check_d92be03b-2b9b-4819-8e5f-169818b5d9e8.svg');
  27. background-position: center;
  28. background-repeat: no-repeat;
  29. background-size: contain;
  30. }

更改后的样式

声明:本文内容由网友自发贡献,转载请注明出处:【wpsshop博客】
推荐阅读
  

闽ICP备14008679号