radio桌球选择效果

代码语言:html

所属分类:表单美化

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


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

<style>
* {
  border: 0;
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  font-size: calc(32px + (40 - 32)*(100vw - 320px)/ (1024 - 320));
}

body {
  background-image: url("http://repo.bfw.wiki/bfwrepo/image/5e4350528640e.png?x-oss-process=image/auto-orient,1/resize,m_fill,w_800,h_800,/quality,q_90");
  background-position: 50% 50%;
  color: #381803;
  display: flex;
  font: 1em Nunito, sans-serif;
  height: 100vh;
  line-height: 1.5;
}

form {
  margin: auto;
  max-width: 10em;
  padding: 1.5em 0;
  position: relative;
}
form label:before, form span:before {
  border-radius: 50%;
  content: "";
}
form label {
  cursor: pointer;
  display: flex;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
form label:before {
  background: radial-gradient(100% 100% at 33% 33%, rgba(0, 0, 0, 0.25) 25%, rgba(0, 0, 0, 0) 50%), radial-gradient(100% 100% at 67% 67%, rgba(255, 255, 255, 0.15), rgba(255, 255, 255, 0) 50%);
  box-shadow: 0 0 0.75em #000 inset;
  display: inline-block;
  margin-right: 0.375em;
  width: 1.5em;
  height: 1.5em;
}
form label:not(:last-of-type) {
  margin-bottom: 1.5em;
}
form span {
  position: absolute;
  top: 1.75em;
  left: 0.25em;
  width: 1em;
  height: 1em;
  transition: transform 0.25s linear;
  z-index: 1;
}
form span, form span:before {
  display: block;
}
form span:before {
  background-color: #2762f3;
  background-image: radial-gradient(10% 10% at 50% 50%, rgba(255, 255, 255, 0.6) 50%, rgba(255, 255, 255, 0)), radial-gradient(12% 12% at 60% 25%, rgba(255, 255, 255, 0.6) 50%, rgba(255, 255, 255, 0)), radial-gradient(100% 100% at 60% 50%, rgba(0, 0, 0, 0) 25%, rgba(0, 0, 0, 0.25) 50%);
  border-radius: 50%;
  box-shadow: 0 0.1em 0.1em 0 rgba(0, 0, 0, 0.5), 0 0 0.1em 0.1em rgba(0, 0, 0, 0.25) inset;
  width: 100%;
  height: 100%;
}

input {
  position: fixed;
  top: -1.5em;
  left: -1.5em;
}

input:nth-of-type(1):checked ~ span {
  transform: translateY(0em);
}
input:nth-of-type(1):checked ~ span:before {
  animation: wobble1 0.5s linear forwards;
}

@keyframes wobble1 {
  from, to {
    transform: translateY(0) scale(1);
  }
  25% {
    transform: translateY(0) scale(1.33);
  }
  50% {
    transform: translateY(0.25em) scale(1);
  }
  67% {
    transform: translateY(-0.15em) scale(1);
  }
  83% {
    transform: translateY(0.0.........完整代码请登录后点击上方下载按钮下载查看

网友评论0