前端之阴影效果

<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>标题</title>
		
		<style>
			*{
				padding: 0;
				margin: 0;
			}
			
			input[type='checkbox'] {
				-webkit-appearance: none;
				margin: 50px;
				border: 10px solid #c1c1c1;
				border-radius: 50px;
				width: 170px;
				height: 70px;
				background-color: #888;
				position: relative;
				/* 阴影:0px是left值,0px是top值,10px是模糊值,1px是扩大范围,black是影子的颜色,inset是向内,默认向外 */
				box-shadow: 0px 0px 10px 1px #3f3f3f inset;
				/* transition: width(过度属性) 1s(过渡时间) ease-in(过渡方式) 2s(过渡时间) */
				transition: 0.6s;
			}
			
			/* 伪元素选择器,选择才有效 */
			input[type='checkbox']:checked {
				background-color: #6FB500;
			}
			
			/* 伪元素选择器,是作为子元素的 */
			input[type='checkbox']::after {
				content: "";
				display: block;
				width: 60px;
				height: 60px;
				position: absolute;
				left: -5px;
				top:-5px;
				border-radius: 30px;
				/* background-color: gray; */
				/* linear-gradient是向下,#d3d3d3是开始的元素,#9e9e9e是结束的颜色 */
				background: linear-gradient(to bottom, #d3d3d3, #9e9e9e);
				/* 可以设置多个阴影 */
				box-shadow: 0px 2px 2px 0px #eee inset, 2px 1px 2px 0px #333;
				transition: 0.6s;
			}
		
			
			input[type='checkbox']:checked::after {
				left: 95px;
			}
		</style>
	</head>
	
	<body>
		<input type="checkbox"/>
	
	</body>
</html>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值