I've created a CSS slider, but I'm facing an issue where clicking the bullet and arrow navigation scrolls to the top of the slider from the extra space. Is there a way to prevent this behavior using only HTML and CSS?
I've tried using a href="#s3/"
and a href="#s3!"
, but it didn't work as expected.
I'm looking for a pure HTML and CSS solution since we are not using any scripting CMS. Thank you!
.wrapper {
overflow:scroll;
height:700px;
}
/* For visual purpose only */
.extra-space {
width: 100%;
height: 300px;
background: red;
line-height: 300px;
text-align: center;
}
/*slider*/
.CSSgal {
position: relative;
overflow: hidden;
/* Or set a fixed height */
}
/* SLIDER */
.CSSgal .slider {
height: 100%;
white-space: nowrap;
font-size: 0;
transition: 0.8s;
}
/* SLIDES */
.CSSgal .slider>* {
display: inline-block;
white-space: normal;
vertical-align: top;
height: 100%;
width: 100%;
background: none 50% no-repeat;
background-size: cover;
}
/* PREV/NEXT, CONTAINERS & ANCHORS */
.CSSgal .prevNext {
position: absolute;
z-index: 1;
top: 50%;
width: 100%;
height: 0;
}
.CSSgal .prevNext>div+div {
visibility: hidden;
}
.CSSgal .prevNext a {
...
...
</div>