I am trying to replace the horizontal scrollbar in this code to arrow buttons ( not entire page but the images scrolling).
I used this code
.scroll-images::-webkit-scrollbar{
-webkit-appearance: none;
}
But the scrollbar is not getting removed.
This is the entire code.
<!DOCTYPE html>
<html lang="en">
<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>Horizontal Scroll Bar</title>
<style>
*{
margin: 0px;
padding: 0px;
box-sizing: border-box;
background-color: black;
}
body {
display: flex;
align-items: center;
justify-content: center;
height: 100vh;
width: 100%;
background-color: black;
}
.main-scroll-div{
width: 90%;
height: 100%;
display: flex;
align-items: center;
justify-content: space-between;
border: 2px solid red;
}
.cover{
position: relative;
width: 90%;
height: 50%;
}
.scroll-images{
width: 100%;
height: auto;
display: flex;
justify-content: left;
align-items: center;
overflow: auto;
position: relative;
scroll-behavior: smooth;
}
.child{
min-width: 600px;
height: 450px;
margin: 1px 10px;
cursor: pointer;
border: 1px solid white;
overflow: hidden;
}
.child-img{
width: 100%;
height: 100%;
}
.scroll-images::-webkit-scrollbar{
-webkit-appearance: none;
}
.icon{
color: green;
background-color: black;
font-size: 50px;
outline: none;
border: none;
padding: opx 20px;
cursor: pointer;
}
</style>
</head>
<body>
<div class="main-scroll-div">
<div>
<button class ="icon"> <i class="left"></i></button>
</div>
<div class ="cover">
<div class="scroll-images">
<div class="child"><img class="child-img" src="imges/1.jpg" alt="image"></div>
<div class="child"><img class="child-img" src="imges/2.jpg" alt="image"></div>
<div class="child"><img class="child-img" src="imges/3.jpg" alt="image"></div>
<div class="child"><img class="child-img" src="imges/4.jpg" alt="image"></div>
</div>
</div>
<div>
<button class ="icon"> <i class="left"></i></button>
</div>
</div>
</body>
</html>
I have tried
display : none
but it also didn’t work.
also
appearance : none
2
Answers
I dont no that much but try this
::-webkit-scrollbar is non-standard and you need to check for cross-browser before using it. Try this: