css美化range实现飞机飞行滑竿滑块取值器代码
代码语言:html
所属分类:拖放
代码描述:css美化range实现飞机飞行滑竿滑块取值器代码
代码标签: css 美化 range 飞机 飞行 滑竿 滑块 取值器 代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html>
<html lang="en" >
<head>
<meta charset="UTF-8">
<style>
body {
min-height: 100vh;
margin: 0;
display: grid;
place-items: center;
background: #c2e5f9;
}
.flight-component {
--w: min(700px, 90vw);
width: var(--w);
display: flex;
align-items: center;
justify-content: space-between;
gap: 0.5em;
font-family: Helvetica, Arial, sans-serif;
font-weight: 200;
font-size: 1.25rem;
}
/*
Didn't nest this one, in case I wanted to use the input by itself
without the div/span structure (in that case: add width!!)
*/
.flight-component input,
input.flight {
--bg: #6c6c84;
--scale: clamp(1, calc(1 + 0.5 * sin(pi * var(--val) / 100)), 2);
--shadow: clamp(0.15em, calc(1em * sin(pi * var(--val) / 100)), 1em);
--opacity: clamp(0.2, calc(1 - sin(pi * var(--val) / 100)), 0.4);
--color: rgb(0 0 0 / var(--opacity));
--primary: #f0f4fc;
--secondary: #b55;
--val: 0;
--height: 3em;
appearance: none;
container-type: inline-size;
flex: 1;
height: var(--height);
border: none; /* Firefox adds a default border */
border-radius: 10em;
position: relative;
background:
radial-gradient(circle at 0.35em 50%, var(--bg) 0.35em, #0000 0) no-repeat,
radial-gradient(circle at calc(100% - 0.35em) 50%, var(--bg) 0.35em, #0000 0) no-repeat,
linear-gradient(#0000 45%, var(--bg) 0 55%, #0000 0) 50% 50% / 99% 100%,
#f000;
border: 0;
/*
the ::before and ::after won't work on Firefox for input range,
so only use for decoration on the other browsers
*/
&::before {
content: "";
width: calc(var(--val) * 1%);
min-width: 0.5em;
height: 100%;
position: absolute;
top: 0;
left: 0;
background:
radial-gradient(circle at 0.35em 50%, #000 0.35em, #0000 0) no-repeat,
linear-gradient(#0000 45%, #000 0 55%, #0000 0) 50% 50% / calc(100% - 1em) 100% no-repeat,
#f000;
}
&::after {
content: "";
width: 100%;
height: 12em;
position: absolute;
top: 50%;
left: 0;
transform: translate(0, -50%);
pointer-events: none;
background:
/* cloud 1 */
radial-gradient(3% 20% at 50% 20%, #fff 40%, #0000 0),
radial-gradient(3% 20% at 52.5% 13%, #fff 40%, #0000 0),
radial-gradient(2% 20% at 51% 10%, #fff 40%, #0000 0),
radial-gradient(2.5% 20% at 51.5% 27%, #fff 50%, #0000 0),
radial-gradient(2% 20% at 53% 23%, #fff 60%, #0000 0),
radial-gradient(4% 40% at 55% 20%, #fff 40%, #0000 0),
/* cloud 2 */
radial-gradient(3% 20% at 40% 80%, #fff 40%, #0000 0),
radial-gradient(3% 20% at 42.5% 87%, #fff 40%, #0000 0),
radial-gradient(2% 20% at 41% 90%, #fff 40%, #0000 0),
radial-gradient(2.5% 20% at 41.5% 72%, #fff 50%, #0000 0),
radial-gradient(2% 20% at 43% 73%, #fff 60%, #0000 0),
radial-gradient(4% 40% at 40% 78%, #fff 40%, #0000 0);
background-size: 300% 100%;
background-position: calc(var(--val) * 1%) 0;
-webkit-mask: linear-gradient(90deg, #0000, #0.........完整代码请登录后点击上方下载按钮下载查看
网友评论0