文章阅读

沉浸阅读完整内容

写文章

自定义checkbox样式

正在统计阅读人数 正在统计字数
登录收藏0
字号 100%

效果图:
自定义checkbox样式


自定义checkbox样式

HTML

<div class="list">
            <label><input type="checkbox">旅游</label>
            <label><input type="checkbox">娱乐</label>
            <label><input type="checkbox">学习</label>
            <label><input type="checkbox">打篮球</label>
        </div>

CSS

    .list {
                user-select: none;
                margin-top: 10px;
                text-align: center;
                height: 20px;
            }

            .list input {
                margin: 0 5px;
                /* 相对定位 */
                position: relative;
            }

            .list input::after {
                content: "";
                width: 18px;
                height: 18px;
                background-color: #8b8b8b;
                /* 绝对定位 */
                position: absolute;
                /* 圆 */
                border-radius: 50%;
                top: -3px;
                left: -3px;
            }

            .list input::before {
                position: absolute;
                content: "√";
                z-index: 2;
            }

            .list input:checked::after {
                background-color: red;
            }

            .list input:checked::before {
                color: #fff;
            }

推荐阅读

4 篇精选
文章 / 118vscode中CodeRunner运行ts文件显示中文乱码如何解决? 文章 / 116uniapp打包H5详细教程 文章 / 117jsconfig.json在vue项目中如何使用 文章 / 119tsc : 无法将“tsc”项识别为 cmdlet、函数、脚本文件或可运行程序的名称

发表评论

评论 0

还没有评论,欢迎留下第一条讨论。

分享精彩,传递价值

生成专属海报,分享你的文章,让更多人发现好内容

浏览器不支持 Canvas,无法生成海报。

每日签到

每天来这里,记录一点持续积累。

当前积分--积分
本月签到--
本月获得--积分
正在读取