表单checkbox及radio美化效果代码

代码语言:html

所属分类:表单美化

代码描述:表单checkbox及radio美化效果代码

代码标签: radio 美化 效果

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


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

<head>

  <meta charset="UTF-8">

  
<style>
@import url(https://fonts.googleapis.com/css?family=Open+Sans:400,300,700);
body {
  font-family: 'Open Sans', sans-serif;
  font-weight: 300;
  background: #54bded;
  color: #fff;
  padding-top: 20px;
}

form {
  width: 80%;
  margin: 0 auto;
}

h1 {
  font-size: 30px;
  line-height: 3;
  text-align: center;
  font-weight: 700;
  line-height: 1;
  margin-bottom: 30px;
}
h1 span {
  margin-top: 10px;
  display: block;
  font-weight: 300;
  font-size: 70%;
  line-height: 1.2;
}

div.controls {
  margin-bottom: 12px;
  border: 1px dotted #fafafa;
  padding: 25px 20px;
  position: relative;
  margin-bottom: 20px;
}
div.controls h1 {
  font-size: 18px;
  font-weight: 400;
  line-height: 1;
  text-transform: uppercase;
  display: inline-block;
  position: absolute;
  left: 10px;
  top: -10px;
  padding: 0 10px;
  color: #fafafa;
  background-color: #54bded;
}

input[type='radio'],
input[type='checkbox'] {
  display: none;
  cursor: pointer;
}
input[type='radio']:focus, input[type='radio']:active,
input[type='checkbox']:focus,
input[type='checkbox']:active {
  outline: none;
}
input[type='radio'] + label,
input[type='checkbox'] + label {
  cursor: pointer;
  display: inline-block;
  position: relative;
  padding-left: 25px;
  margin-right: 10px;
  color: #0b4c6a;
}
input[type='radio'] + label:before, input[type='radio'] + label:after,
input[type='checkbox'] + label:before,
input[type='checkbox'] + label:after {
  content: '';
  font-family: helvetica;
  display: inline-block;
  width: 18px;
  height: 18px;
  left: 0;
  bottom: 0;
  text-align: center;
  position: absolute;
}
input[type='radio'] + label:before,
input[type='checkbox'] + label:before {
  background-color: #fafafa;
  -moz-transition: all 0.3s ease-in-out;
  -o-transition: all 0.3s ease-in-out;
  -webkit-transition: all 0.3s ease-in-out;
  transition: all 0.3s ease-in-out;
}
input[type='radio'] + label:after,
input[type='checkbox'] + label:after {
  color: #fff;
}
input[type='radio']:checked + label:before,
input[type='checkbox']:checked + label:before {
  -moz-box-shadow: inset 0 0 0 10px #158EC6;
  -webkit-box-shadow: inset 0 0 0 10px #158EC6;
  box-shadow: inset 0 0 0 10px #158EC6;
}

/*Radio Specific styles*/
input[type='radio'] + label:before {
  -moz-border-radius: 50%;
  -webkit-border-radius: 50%;
  border-radius: 50%;
}
input[type='radio'] + label:hover:after, input[type='radio']:checked + label:after {
  content: '\2022';
  position: absolute;
  top: 0px;
  font-size: 19px;
  line-height: 15px;
}
input[type='radio'] + label:hover:after {
  color: #c7c7c7;
}
input[type='radio']:checked + label:after, input[type='radio']:checked + label:hover:after {
  color: #fff;
}

/*Checkbox Specific styles*/
input[type='checkbox'] + label:before {
  -moz-border-radius: 3px;
  -webkit-border-radius: 3px;
  b.........完整代码请登录后点击上方下载按钮下载查看

网友评论0