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

<input class="check-input" type="checkbox">
   .check-input {
      width: 16px;
      height: 16px;
    }    

/* 设置默认的checkbox样式 */
  input.check-input[type="checkbox"] {
    -webkit-appearance: none; /* 移除默认样式 */
    border: 1px solid #999;
    outline: none;
    border-radius: 2px;
    border: 1px solid #4C4E4F;
    background: #FFF; 
    position: relative;
  }
 
  /* 设置选中状态下的checkbox样式 */
  input.check-input[type="checkbox"]:checked {
    background-color: red; /* 你可以更改这个颜色为你想要的颜色 */
  }
  /* 显示对勾 */
  #europe-collection-list input.check-input[type="checkbox"]:checked::after {
    content: "";
    display: block;
    width: 15px;
    height: 15px;
    position: absolute;
    background-image: url('https://files/check_d92be03b-2b9b-4819-8e5f-169818b5d9e8.svg');
    background-position: center;
    background-repeat: no-repeat;
    background-size: contain;
  }

更改后的样式

相关推荐

  1. 解决elementUI中使用checkbox无法选中问题

    2024-04-08 23:10:03       53 阅读
  2. 微信小程序修改checkbox和radio样式

    2024-04-08 23:10:03       42 阅读
  3. html自定义禁用状态下且已选中checkbox

    2024-04-08 23:10:03       33 阅读

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-04-08 23:10:03       98 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-04-08 23:10:03       106 阅读
  3. 在Django里面运行非项目文件

    2024-04-08 23:10:03       87 阅读
  4. Python语言-面向对象

    2024-04-08 23:10:03       96 阅读

热门阅读

  1. ComfyUI是什么?

    2024-04-08 23:10:03       41 阅读
  2. 前端开发语言有哪些?

    2024-04-08 23:10:03       38 阅读
  3. ML Olympiad returns with over 20 challenges

    2024-04-08 23:10:03       41 阅读
  4. 224.0.0.1到224.0.0.9的IP地址

    2024-04-08 23:10:03       38 阅读
  5. 题目 3158: 三国游戏

    2024-04-08 23:10:03       32 阅读
  6. Azure AI 新发布了 9 种更逼真的对话 AI 声音

    2024-04-08 23:10:03       37 阅读
  7. 动态规划(2)

    2024-04-08 23:10:03       35 阅读
  8. 汇编语言和C语言得优势和劣势简析

    2024-04-08 23:10:03       63 阅读
  9. 备战蓝桥杯---最长上升子序列(LIS)模板

    2024-04-08 23:10:03       43 阅读