css实现胶囊checkbox开关按钮效果代码

代码语言:html

所属分类:表单美化

代码描述:css实现胶囊checkbox开关按钮效果代码

代码标签: checkbox 开关 按钮 效果

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


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

<head>

  <meta charset="UTF-8">
  

  <meta name="viewport" content="width=device-width, initial-scale=1">
  
  
  
<style>
/*
 * <input type=checkbox class=switch>
 * License: MIT
 */
input[role=switch] {
	appearance: none;
	-webkit-appearance: none;
	position: relative;
	display: inline-block;
	width: 2.4em;
	height: 1.4em;
	margin: -.2em 0;
	box-sizing: content-box;
	padding: 0;
	border: none;
	border-radius: .7em;
	background: rgba(160,160,160,0.7);
	box-shadow: 0 .15em .25em rgba(0,0,0,0.5) inset, 0 -.5px 0 rgba(255,255,255,0.2) inset;
	transition: background-color 250ms ease, box-shadow 250ms ease;
	font-size: 100%;
	text-size-adjust: 100%;
	-webkit-text-size-adjust: 100%;
	user-select: none;
	outline: none;
}
input[.........完整代码请登录后点击上方下载按钮下载查看

网友评论0