div+css+js实现单选多选按钮自定义美化效果代码

代码语言:html

所属分类:表单美化

代码描述:div+css+js实现单选多选按钮自定义美化效果代码

代码标签: div css js 单选 多选 按钮 自定义 美化

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

<!DOCTYPE html>
<html lang="en" >
<head>
  <meta charset="UTF-8">
<style>
    @import url(https://fonts.googleapis.com/css?family=Roboto);

body {
  height: 100vh;
  width: 100vw;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  font-family: "Roboto", sans-serif;
}

.button-panel {
  display: flex;
  align-items: center;
}

.button-panel > div {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 30px;
  border-radius: 15px;
  background: rgb(60, 60, 90);
}

button {
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  border: none;
  border-radius: 5px;
  text-transform: uppercase;
  justify-content: space-between;
  color: white;
  cursor: pointer;
  box-shadow: 0 0 2px rgba(0, 0, 0, 0.4), 0 0 8px rgba(0, 0, 0, 0.3);
}

.outer-circle {
  width: 20px;
  height: 20px;
  border: 3px solid white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 2px 2px rgba(0, 0, 0, 0.1);
}

.inner-circle {
  width: 0;
  height: 0;
  background: white;
  border-radius: 50%;
  opacity: 0.5;
  transition: 0.2s;
}

.active .inner-circle {
  opacity: 1;
  width: 12px;
  height: 12px;
}

.toggle-all {
  height: 100px;
  width: 50px;
  padding: 10px;
  box-shadow: none;
  border-radius: 0 15px 15px 0;
  background: rgb(60, 60, 90);
  margin: 0;
  left: -2px;
  position: relative;
}
</style>
</head>
<body>
<!-- partial:index.partial.html -->
<div class="button-panel">
  <div>
    <button class="toggle active" style="background:#7700ff" onClick="toggle(this)">
      Item 1
      <div class="outer-circle">
        <div class="inner-circle"></div>
      </d.........完整代码请登录后点击上方下载按钮下载查看

网友评论0