checkbox美化

代码语言:html

所属分类:表单美化

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

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">

<link href="https://fonts.googleapis.com/css?family=Roboto:700" rel="stylesheet">

<style>
html,
body {
  height: 100%;
}

body {
  background: #ff9e21;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  font-family: 'Roboto', sans-serif;
}

.radio {
  background: #1e1e1e;
  border-radius: 50px;
  padding: 10px 15px;
  color: #626262;
  font-weight: bold;
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 45px;
  width: 245px;
  font-size: 21px;
  position: relative;
  transition: all .5s ease-in-out;
  margin-bottom: 20px;
}
.radio.off {
  background: #fff;
}
.radio.off .bar {
  background: #ccc;
  left: 136px;
}
.radio.off label[for='on'] {
  color: #626262;
}
.radio.off label[for='off'] {
  color: #000;
}
.radio .wrap {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-radius: 50px;
  overflow: hidden;
  position: relative;
  height: 40px;
}
.radio input {
  opacity: 0;
  pointer-events: none;
}
.radio label {
  position: relative;
  z-index: 1;
  cursor: pointer;
  transition: all .5s ease-in-out;
  -webkit-user-select: none;
     -moz-user-select: none;
      -ms-user-select: none;
          user-select: none;
}
.radio label[for='on'] {
  margin-left: 10px;
  color: #000;
}
.radio label[for='off'] {
  margin-right: 10px;
}
.radio #on {
  position: absolute;
  left: 0;
  top: 50%;
  -webkit-transform: translateY(-50%);
          transform: translateY(-50%);
}
.radio #off {
  position: absolute;
.........完整代码请登录后点击上方下载按钮下载查看

网友评论0