css实现立体木质凹槽圆球滚动checkbox开关效果代码

代码语言:html

所属分类:表单美化

代码描述:css实现立体木质凹槽圆球滚动checkbox开关效果代码,点击可实现切换,美化了checkbox标签。

代码标签: cs 立体 木质 凹槽 圆球 滚动 checkbox 开关

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

<!DOCTYPE html>

<html lang="en">

<head>

    <meta charset="UTF-8">


    <meta name="viewport" content="width=device-width, initial-scale=1">



    <style>
        img {
        	position: absolute;
        	top: 50%;
        	left: 50%;
        	transform: translate(-50%, -50%);
        }
        body{
        	margin:0 auto;
        	height:100vh;
        	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='100%25' width='100%25'%3E%3Cdefs%3E%3Cpattern id='planks' width='100%25' height='20%25' patternUnits='userSpaceOnUse'%3E%3Crect width='100%25' height='1.7'%3E%3C/rect%3E%3C/pattern%3E%3Cfilter id='filter294'%3E%3CfeTurbulence baseFrequency='0.0009 0.003' numOctaves='10' seed='5' /%3E%3CfeColorMatrix values='1.6 2.6 3.4 1 5 1.5 4.8 2.1 3.3 5 1.6 3.1 4.1 0.6 3.7 2.8 4.8 0.6 2.3 -3.4' /%3E%3C/filter%3E%3Cfilter id='grain'%3E%3CfeTurbulence baseFrequency='0.002 0.2' numOctaves='1'%3E%3C/feTurbulence%3E%3CfeColorMatrix values='-0.7 -2.2 -2.7 4.6 -3 -0.4 5 2.4 2.9 -4.5 -1.1 -3.8 -0.6 -2.8 -0.8 1.3 -3.3 -4.2 -1.5 0.2'%3E%3C/feColorMatrix%3E%3CfeDiffuseLighting lighting-color='%23966F33' surfaceScale='2'%3E%3CfeDistantLight azimuth='45' elevation='45'%3E%3C!-- %3Canimate attributeName='azimuth' from='0' to='360' dur='2s' repeatCount='indefinite' /%3E --%3E%3C/feDistantLight%3E%3C/feDiffuseLighting%3E%3C/filter%3E%3Cfilter id='squiggle'%3E%3CfeTurbulence baseFrequency='0.001' type='fractalNoise' numOctaves='1' /%3E%3CfeDisplacementMap in='SourceGraphic' xChannelSelector='R' yChannelSelector='B' scale='23.5' /%3E%3CfeGaussianBlur stdDeviation='0.8' /%3E%3C/filter%3E%3C/defs%3E%3Crect width='100%25' height='100%25' fill='%23966F33'%3E%3C/rect%3E%3Crect width='100%25' height='100%25' filter='url(%23grain)'%3E%3C/rect%3E%3Crect width='100%25' height='100%25' filter='url(%23filter294)' style='opacity:0.05' /%3E%3Crect width='100%25' height='100%25' fill='url(%23planks)' filter='url(%23squiggle)'%3E%3C/rect%3E%3C/svg%3E");
        	overflow:hidden;
        }
        
        .toggleContainer0 {
        	position: absolute;
        	top: 10%;
        	left: 50%;
        	transform: translate(-50%, -50%);
        	height: 200px;
        	width: 200px;
        }
 
        /* The switch - the box around the slider */
        .switch {
        	position: absolute;
        	height: 20%;
        	width: 80%;
        	/* 	border:3px solid red; */
        	position: absolute;
        	top: 50%;
        	left: 50%;
        	transform: translate(-50%, -50%);
        }
        .switch:before {
        	content: "";
        	position: absolute;
        	height: 120%;
        	width: 105%;
        	left: 50%;
        	top: 50%;
        	transform: translate(-50%, -50%);
        	border-radius: 99px;
        	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='100%25' width='100%25'%3E%3Cdefs%3E%3Cfilter id='filter294'%3E%3CfeTurbulence baseFrequency='0.0009 0.003' numOctaves='10' seed='5' /%3E%3CfeColorMatrix values='1.6 2.6 3.4 1 5 1.5 4.8 2.1 3.3 5 1.6 3.1 4.1 0.6 3.7 2.8 4.8 0.6 2.3 -3.4' /%3E%3C/filter%3E%3Cfilter id='grain'%3E%3CfeTurbulence baseFrequency='0.002 0.2' numOctaves='1'%3E%3C/feTurbulence%3E%3CfeColorMatrix values='-0.7 -2.2 -2.7 4.6 -3 -0.4 5 2.4 2.9 -4.5 -1.1 -3.8 -0.6 -2.8 -0.8 1.3 -3.3 -4.2 -1.5 0.2'%3E%3C/feColorMatrix%3E%3CfeDiffuseLighting lighting-color='%23966F33' surfaceScale='2'%3E%3CfeDistantLight azimuth='45' elevation='45'%3E%3C!-- %3Canimate attributeName='azimuth' from='0' to='360' dur='2s' repeatCount='indefinite' /%3E --%3E%3C/feDistantLight%3E%3C/feDiffuseLighting%3E%3C/filter%3E%3C/defs%3E%3Crect width='100%25' height='100%25' fill='%23966F33'%3E%3C/rect%3E%3C.........完整代码请登录后点击上方下载按钮下载查看

网友评论0