css实现一个狗与猫切换的胶囊开关效果代码

代码语言:html

所属分类:表单美化

代码描述:css实现一个狗与猫切换的胶囊开关效果代码

代码标签: 切换 胶囊 开关 效果

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


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

<head>

 
<meta charset="UTF-8">

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

body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background-color: #ce93d8;
  color: #511f0b;
  background-image: url('data:image/svg+xml,%3Csvg width="52" height="26" viewBox="0 0 52 26" xmlns="http://www.w3.org/2000/svg"%3E%3Cg fill="none" fill-rule="evenodd"%3E%3Cg fill="%239C92AC" fill-opacity="0.4"%3E%3Cpath d="M10 10c0-2.21-1.79-4-4-4-3.314 0-6-2.686-6-6h2c0 2.21 1.79 4 4 4 3.314 0 6 2.686 6 6 0 2.21 1.79 4 4 4 3.314 0 6 2.686 6 6 0 2.21 1.79 4 4 4v2c-3.314 0-6-2.686-6-6 0-2.21-1.79-4-4-4-3.314 0-6-2.686-6-6zm25.464-1.95l8.486 8.486-1.414 1.414-8.486-8.486 1.414-1.414z" /%3E%3C/g%3E%3C/g%3E%3C/svg%3E');
}

button {
  background: none;
  border: 0;
  cursor: pointer;
  font-size: inherit;
  color: inherit;
}

.toggle-switch {
  width: 18rem;
  height: 8rem;
  border: 4px solid;
  border-radius: 4rem;
  position: relative;
  background-color: #fff;
}
.toggle-switch *,
.toggle-switch *::before,
.........完整代码请登录后点击上方下载按钮下载查看

网友评论0