HTML _CSS
Neumorphism Custom Range Slider
HiroDaegu
2022. 7. 30. 00:58
728x90
SMALL
<!DOCTYPE html>
<html lang="ko">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>NEUMORPHISM CUSTOM RANGE SLIDER</title>
<link rel="stylesheet" href="style.css">
<script defer src="main.js"></script>
</head>
<body>
<div class="box">
<input type="range" class="range" value="0" min="0" max="100">
<div id="rangeValue">0</div>
</div>
</body>
</html>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
background-color: #EDF1F4;
}
.box {
position: relative;
display: flex;
justify-content: center;
align-items: center;
padding: 20px;
background: linear-gradient(to bottom, rgba(0, 0, 0, .05), #EDF1F4);
border-radius: 40px;
box-shadow: 15px 15px 20px rgba(0, 0, 0, .1), -15px 15px 20px #FFF;
}
.range {
width: 400px;
height: 15px;
appearance: none;
background-color: #EDF1F4;
outline: none;
border-radius: 15px;
box-shadow: 5px 5px 5px rgba(0, 0, 0, .1), -5px -5px 10px #FFF, inset 5px 5px 5px rgba(0, 0, 0, .1);
overflow: hidden;
}
.range::-webkit-slider-thumb {
appearance: none;
width: 15px;
height: 15px;
background: #FFF;
border-radius: 50%;
border: 2px solid #0074CF;
box-shadow: -407px 0 0 400px #27A0FF;
cursor: pointer;
}
#rangeValue {
position: relative;
text-align: center;
width: 60px;
font-size: 1.25em;
font-weight: 500;
color: #FFF;
background-color: #27A0FF;
margin-left: 15px;
border-radius: 25px;
box-shadow: 5px 5px 10px rgba(0, 0, 0, .1), -5px -5px 10px #FFF, inset 5px 5px 10px rgba(0, 0, 0, .1), inset -5px -5px 5px rgba(255, 255, 255, .25);
}
let range = document.querySelector(".range");
range.addEventListener("mousemove", rangeSlider);
function rangeSlider() {
let rangeval = range.value;
document.getElementById("rangeValue").innerHTML = rangeval;
}
728x90
LIST