css实现亮色和暗色切换模式下的单选多选radio checkbox美化效果代码

代码语言:html

所属分类:表单美化

代码描述:css实现亮色和暗色切换模式下的单选多选radio checkbox美化效果代码

代码标签: css 亮色 暗色 切换 模式 单选 多选 radio checkbox 美化

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

<!DOCTYPE html>
<html lang="en">

<head>
   
<meta charset="UTF-8">
   
<link type="text/css" rel="stylesheet" href="//repo.bfw.wiki/bfwrepo/css/unicons.css">
<style>
    /* Please ❤ this if you like it! */


@import url('https://fonts.googleapis.com/css?family=Poppins:100,100i,200,200i,300,300i,400,400i,500,500i,600,600i,700,700i,800,800i,900,900i&subset=devanagari,latin-ext');


:root {
        --white: #ffffff;
        --light: #f0eff3;
        --black: #000000;
        --dark-blue: #1f2029;
        --dark-light: #353746;
        --red: #da2c4d;
        --yellow: #f8ab37;
        --grey: #ecedf3;
}

/* #Primary
================================================== */

body{
        width: 100%;
        background: var(--dark-blue);
        overflow-x: hidden;
    font-family: 'Poppins', sans-serif;
        font-size: 17px;
        line-height: 30px;
        -webkit-transition: all 300ms linear;
        transition: all 300ms linear;
}
p{
    font-family: 'Poppins', sans-serif;
        font-size: 17px;
        line-height: 30px;
        color: var(--white);
        letter-spacing: 1px;
        font-weight: 500;
        -webkit-transition: all 300ms linear;
        transition: all 300ms linear;
}
::selection {
        color: var(--white);
        background-color: var(--black);
}
::-moz-selection {
        color: var(--white);
        background-color: var(--black);
}
mark{
        color: var(--white);
        background-color: var(--black);
}
.section {
    position: relative;
        width: 100%;
        display: block;
        text-align: center;
        margin: 0 auto;
}
.over-hide {
    overflow: hidden;
}
.z-bigger {
    z-index: 100 !important;
}


.background-color{
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background-color: var(--dark-blue);
        z-index: 1;
        -webkit-transition: all 300ms linear;
        transition: all 300ms linear;
}
.checkbox:checked ~ .background-color{
        background-color: var(--white);
}


[type="checkbox"]:checked,
[type="checkbox"]:not(:checked),
[type="radio"]:checked,
[type="radio"]:not(:checked){
        position: absolute;
        left: -9999px;
        width: 0;
        height: 0;
        visibility: hidden;
}
.checkbox:checked + label,
.checkbox:not(:checked) + label{
        position: relative;
        width: 70px;
        display: inline-block;
        padding: 0;
        margin: 0 auto;
        text-align: center;
        margin: 17px 0;
        margin-top: 100px;
        height: 6px;
        border-radius: 4px;
        background-image: linear-gradient(298deg, var(--red), var(--yellow));
        z-index: 100 !important;
}
.checkbox:checked + label:before,
.checkbox:not(:checked) + label:before {
        position: absolute;
        font-family: 'unicons';
        cursor: pointer;
        top: -17px;
        z-index: 2;
        font-size: 20px;
        line-height: 40px;
        text-align: center;
        width: 40px;
        height: 40px;
        border-radius: 50%;
        -webkit-transition: all 300ms linear;
        transition: all 300ms linear;
}
.checkbox:not(:checked) + label:before {
        content: '\eac1';
        left: 0;
        color: var(--grey);
        background-color: var(--dark-light);
        box-shadow: 0 4px 4px rgba(0,0,0,0.15), 0 0 0 1px rgba(26,53,71,0.07);
}
.checkbox:checked + label:before {
        content: '\eb8f';
        left: 30px;
        color: var(--yellow);
        background-color: var(--dark-blue);
        box-shadow: 0 4px 4px rgba(26,53,71,0.25), 0 0 0 1px rgba(26,53,71,0.07);
}

.checkbox:checked ~ .section .container .row .col-12 p{
        color: var(--dark-blue);
}


.checkbox-tools:checked + label,
.checkbox-tools:not(:checked) + label{
        position: relative;
        display: inline-block;
        padding: 20px;
        width: 110px;
        font-size: 14px;
        line-height: 20px;
        letter-spacing: 1px;
        margin: 0 auto;
        margin-left: 5px;
        margin-right: 5px;
        margin-bottom: 10px;
        text-align: center;
        border-radius: 4px;
        overflow: hidden;
        cursor: pointer;
        text-transform: uppercase;
        color: var(--white);
        -webkit-transition: all 300ms linear;
        transition: all 300ms linear;
}
.checkbox-tools:not(:checked) + label{
        background-color: var(--dark-light);
        box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.1);
}
.checkbox-tools:checked + label{
        background-color: transparent;
        box-shadow: 0 8px 16px 0 rgba(0, 0, 0, 0.2);
}
.checkbox-tools:not(:checked) + label:hover{
        box-shadow: 0 8px 16px 0 rgba(0, 0, 0, 0.2);
}
.checkbox-tools:checked + label::before,
.checkbox-tools:not(:checked) + label::before{
        position: absolute;
        content: '';
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        border-radius: 4px;
        background-image: linear-gradient(298deg, var(--red), var(--yellow));
        z-index: -1;
}
.checkbox-tools:checked + label .uil,
.checkbox-tools:not(:checked) + label .uil{
        font-size: 24px;
        line-height: 24px;
        display: block;
        padding-bottom: 10px;
}

.checkbox:checked ~ .section .container .row .col-12 .checkbox-tools:not(:checked) + label{
        background-color: var(--light);
        color: var(--dark-blue);
        box-shadow: 0 1x 4px 0 rgba(0, 0, 0, 0.05);
}

.checkbox-budget:checked + label,
.checkbox-budget:not(:checked) + label{
        position: relative;
        display: inline-block;
        padding: 0;
        padding-top: 20px;
        padding-bottom: 20px;
        width: 260px;
        font-size: 52px;
        line-height: 52px;
        font-weight: 700;
        letter-spacing: 1px;
        margin: 0 auto;
        margin-left: 5px;
        margin-right: 5px;
        margin-bottom: 10px;
        text-align: center;
        border-radius: 4px;
        overflow: hidden;
        cursor: pointer;
        text-transform: uppercase;
        -webkit-transition: all 300ms linear;
        transition: all 300ms linear;
        -webkit-text-stroke: 1px var(--white);
    text-stroke: 1px var(--white);
    -webkit-text-fill-color: transparent;
    text-fill-color: transparent;
    color: transparent;
}
.checkbox-budget:not(:checked) + label{
        background-color: var(--dark-light);
        box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.1);
}
.checkbox-budget:checked + label{
        background-color: transparent;
        box-shadow: 0 8px 16px 0 rgba(0, 0, 0, 0.2);
}
.checkbox-budget:not(:checked) + label:hover{
        box-shadow: 0 8px 16px 0 rgba(0, 0, 0, 0.2);
}
.checkbox-budget:checked + label::before,
.checkbox-budget:not(:checked) + label::before{
        position: absolute;
        content: '';
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        border-radius: 4px;
        background-image: linear-gradient(138deg, var(--red), var(--yellow));
        z-index: -1;
}
.checkbox-budget:checked + label span,
.checkbox-budget:not(:checked) + label span{
        position: relative;
        display: block;
}
.checkbox-budget:checked + label span::before,
.checkbox-budget:not(:checked) + label span::before{
        position: absolute;
        content: attr(data-hover);
        top: 0;
        left: 0;
        width: 100%;
        overflow: hidden;
        -webkit-text-stroke: transparent;
    text-stroke: transparent;
    -webkit-text-fill-color: var(--white);
    text-fill-color: var(--white);
    color: var(--white);
        -webkit-transition: max-height 0.3s;
        -moz-transition: max-height 0.3s;
        transition: max-height 0.3s;
}
.checkbox-budget:not(:checked) + label span::before{
        max-height: 0;
}
.checkbox-budget:checked + label span::before{
        max-height: 100%;
}

.checkbox:checked ~ .section .container .row .col-xl-10 .checkbox-budget:not(:checked) + label{
        background-color: var(--light);
        -webkit-text-stroke: 1px var(--dark-blue);
    text-stroke: 1px var(--dark-blue);
        box-shadow: 0 1x 4px 0 rgba(0, 0, 0, 0.05);
}

.checkbox-booking:checked + label,
.checkbox-booking:not(:checked) + label{
        position: relative;
        display: -webkit-inline-f.........完整代码请登录后点击上方下载按钮下载查看

网友评论0