Skip to main content

CSS复选框生成器

通过可视化编辑器创建自定义CSS复选框。 自由定制动画、颜色和形状。

#6366f1
#ffffff
#d1d5db

预览

HTML代码

<label class="custom-checkbox">
    <input type="checkbox" />
    <span class="checkmark"></span>
    Label text
</label>

CSS代码

.custom-checkbox {
    display: inline-flex;
    align-items: center;
    cursor: pointer;
    user-select: none;
    gap: 8px;
    font-size: 14px;
    color: #374151;
}

.custom-checkbox input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.custom-checkbox .checkmark {
    position: relative;
    height: 24px;
    width: 24px;
    background-color: #ffffff;
    border: 2px solid #d1d5db;
    border-radius: 50%;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.custom-checkbox:hover .checkmark {
    border-color: #6366f1;
}

.custom-checkbox input:checked + .checkmark {
    background-color: #6366f1;
    border-color: #6366f1;
}

.custom-checkbox .checkmark::after {
    content: "";
    position: absolute;
    display: none;
    left: 5px;
    top: 2px;
    width: 6px;
    height: 12px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.custom-checkbox input:checked + .checkmark::after {
    display: block;
}
分享此工具
📖

使用方法

Step 1

选择设计

选择设计

选择复选框设计模板

Step 2

自定义

自定义

调整颜色、大小、圆角、动画等

Step 3

复制代码

复制代码

复制HTML/CSS代码

功能特点

实时预览

实时预览自定义效果

丰富模板

多种动画模板:对勾、滑动、弹跳等

无障碍访问

生成语义化HTML结构,对屏幕阅读器友好的代码

FAQ

用自定义CSS设计替换浏览器默认复选框样式。