div+css实现中性拟态图标按钮开关进度条效果代码
代码语言:html
所属分类:布局界面
代码描述:div+css实现中性拟态图标按钮开关进度条效果代码
代码标签: div css 中性 拟态 图标 按钮 开关 进度条
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en" > <head> <meta charset="UTF-8"> <link type="text/css" rel="stylesheet" href="//repo.bfw.wiki/bfwrepo/css/all.5.11.2.css"> <link href="https://fonts.googleapis.com/css2?family=Roboto:wght@600;700;800;900&display=swap" rel="stylesheet"> <style> @charset "UTF-8"; * { margin: 0; padding: 0; box-sizing: border-box; font-family: "Roboto", sans-serif; } body { background-color: #ecf0f3; } .container { width: 90%; height: 100vh; margin: 0 auto; padding: 40px 0; display: flex; flex-wrap: wrap; justify-content: space-evenly; align-items: center; } .container > * { margin: 10%; } .button_main { width: 200px; height: 200px; border: none; position: relative; border-radius: 35px; color: rgba(78, 149, 185, 0.4); cursor: pointer; font-weight: 600; font-size: 48px; outline: none; text-transform: uppercase; background-color: #ecf0f3; box-shadow: 15px 15px 30px #d1d9e6, -15px -15px 30px #ffffff, inset 0px 0px 0px 0px #d1d9e6, inset 0px 0px 0px 0px #ffffff; -webkit-tap-highlight-color: transparent; user-select: none; transition: all 0.3s cubic-bezier(0.79, 0.21, 0.06, 0.81); } .button_main::before { font-family: "Font Awesome 5 Free"; font-weight: normal; line-height: 0; font-size: 100px; content: ""; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); } .button_main::after { font-family: "Font Awesome 5 Free"; line-height: 0; font-weight: bold; font-size: 100px; content: ""; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); opacity: 0; visibility: hidden; } .button_main:hover { color: rgba(78, 149, 185, 0.6); } .button_main.active { color: rgba(78, 149, 185, 0.8); box-shadow: 0px 0px 0px #d1d9e6, 0px 0px 0px #ffffff, inset 10px 10px 25px #d1d9e6, inset -10px -10px 25px #ffffff; } .button_main.active::after { opacity: 1; visibility: visible; } .button_main.active::before { opacity: 0; } .toggle { position: relative; width: 150px; height: 150px; display: flex; justify-content: center; align-items: center; } .toggle-state { display: none; } .toggle-label { cursor: pointer; display: block; position: relative; height: 60px; width: 120px; border-radius: 30px; background-color: #ecf0f3; -webkit-tap-highlight-color: transparent; box-shadow: -16px -8px 16px #ffffff, 16px 8px 16px #d1d9e6, 8px 8px 8px #d1d9e6 inset, -8px -8px 8px #ffffff inset; } .toggle-label:focus { outline: none; } .toggle-label::after { content: ""; cursor: pointer; position: absolute; display: inline-block; top: 4px; left: 6px; height: 50px; width: 50px; background: linear-gradient(145deg, #fdffff, #d4d8db); border-radius: 100%; transform: translate3d(0, 0, 0); transition: transform 0.3s cubic-bezier(0.8, 0.06, 0.2, 1.3), background 0.4s; box-shadow: 8px 8px 16px #d1d9e6; } .toggle-state:checked + .toggle-label::after { transform: translate3d(56px, 0, 0); background: linear-gradient(145deg, #88c1dd, #396377); } .button_power { width: 200px; height: 200px; border: none; position: relative; border-radius: 100%; color: rgba(78, 149, 185, 0.4); cursor: pointer; font-weight: 600; font-size: 48px; outline: none; text-transform: uppercase; background-color: #ecf0f3; box-shadow: 15px 15px 30px #d1d9e6, -15px -15px 30px #ffffff, inset 0px 0px 0px #d1d9e6, inset 0px 0px 0px #ffffff; transition: all 0.3s cubic-bezier(0.79, 0.21, 0.06, 0.81); -webkit-tap-highlight-color: transparent; user-select: none; } .button_power::after { font-family: "Font Awesome 5 Free"; font-size: 100px; content: ""; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); } .button_power:hover { color: rgba(78, 149, 185, 0.6); } .button_power.active { color: #4e95b9; box-shadow: 0px 0px 0px #d1d9e6, 0px 0px 0px #ffffff, inset 10px 10px 25px #d1d9e6, inset -10px -10px 25px #ffffff; } .progress { width: 250px; height: 340px; display: flex; flex-direction: column; align-items: center; box-shadow: inset -10px -10px 15px #ffffff, inset 10px 10px 15px #d1d9e6; padding-top: 35px; } .progress__outer-ring { position: relative; height: 200px; width: 200px; border-radius: 100%; border: 10px solid #ecf0f3; box-shadow: -15px -15px 25px #ffffff, 15px 15px 25px #d1d9e6, inset -4px -4px 8px rgba(255, 255, 255, 0.1), inset 4px 4px 8px rgba(0, 0, 0, 0.15); } .progress-ring__wrap { width: 180px; height: 180px; } .progress-ring__circle { transition: 0.2s stroke-dashoffset ease-out; transform: rotate(-90deg); transform-origin: 50% 50%; stroke: #4e95b9; stroke-width: 20px; fill: transparent; box-shadow: 10px 10px 25px #000, -10px -10px 25px #000; } .progress__value { width: 140px; height: 140px; background: linear-gradient(145deg, #fdffff, #d4d8db); border-radius: 100%; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); display: flex; justify-content: center; align-items: center; font-size: 48px; font-weight: 600; color: #4e95b9; box-shadow: 4px 4px 8px rgba(0, 0, 0, 0.15), -4px -4px 8px rgba(255, 255, 255, 0.25); } .progress__range-wrap { position: relative; margin-top: 20px; width: 190px; } .progress__range-outer { width: 190px; height: 18px; position: absolute; top: 0; left: 0px; background: #ecf0f3; border-radius: 6px; box-shadow: -5px -5px 10px #ffffff, 5px 5px 10px #d1d9e6; } .progress__range-inner { width: 186px; height: 14px; position: absolute; top: 2px; left: 2px; background: #ecf0f3; border-radius: 5px; display: flex; justify-content: center; align-items: center; box-shadow: inset -4px -4px 8px #ffffff, inset 4px 4px 8px #d1d9e6; } .progress__input { width: 180px; background: transparent; -webkit-appearance: none; } .progress__input:focus { outline: none; } .progres.........完整代码请登录后点击上方下载按钮下载查看
网友评论0