css实现多个radio美化隐藏选择效果代码

代码语言:html

所属分类:表单美化

代码描述:css实现多个radio美化隐藏选择效果代码

代码标签: css radio 美化 隐藏 选择

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


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

<head>

  <meta charset="UTF-8">
  

  
  
  
<style>
:root {
  --accent: #007ECC;
  --accent-2: #EC2F4B;
  --text: #003f66;
  --text-hover: var(--accent);
  --text-active: #FFFFFF;
  --border-width: 0.125em;
}

html, body {
  height: 100%;
}

* {
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
  font-weight: 500;
  display: flex;
  justify-content: center;
  align-items: center;
}

.hidden-toggles {
  position: relative;
  border-radius: 999em;
  overflow: hidden;
  height: 2.75em;
  width: 20em;
  display: flex;
  flex-direction: row-reverse;
}
.hidden-toggles > * {
  flex: 0 0 33.33%;
}
.hidden-toggles:after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  border: var(--border-width) solid var(--accent);
  border-radius: 999em;
  pointer-events: none;
}

.hidden-toggles__input {
  display: none;
}
.hidden-toggles__input:checked + .hidden-toggles__label {
  background-color: var(--accent);
  color: var(--text-active);
}
.hidden-toggles__input:checked + .hidden-toggles__label:before {
  opacity: 1;
}
.hidden-toggles__input:checked + .hidden-toggles__label:last-of-type {
  background: linear-gradient(90deg, var(--accent) 0%, var(--accent-2) 100%);
}
.hidden-toggles__input:nth-of-type(1) + label {
  order: 4;
}
.hidden-toggles__input:nth-of-type(2) + label {
  order: 3;
}
.hidden-toggles__input:nth-of-type(3) + label {
  order: 2;
}
.hidden-toggles__input:nth-of-type(4) + label {
  order: 1;
}
.hidden-toggles__input:nth-of-type(1):checked ~ label:last-.........完整代码请登录后点击上方下载按钮下载查看

网友评论0