as you can see in the images, splides demo has spacing between the sliders. i copied the code exactly and the slides are touching. i want a gap between them. How would you do this?
<body>
<section id="image-carousel" class="splide"
aria-label="Beautiful Images">
<div class="splide__track">
<ul class="splide__list">
<li class="splide__slide">
<img
src="https://th.bing.com/th/id/R.fbabf48626f686c234fb11a5a2ea3775?rik=082x0cClFqLbig&riu=http%3a%2f%2fsplidejs.com%2fimages%2fslides%2ffull%2f01.jpg&ehk=%2fWsS6qfQhyxiACXLqZV5NxqLljy18m0qoXlLW3MXNbA%3d&risl=&pid=ImgRaw&r=0"
alt>
</li>
<li class="splide__slide">
<img
src="https://th.bing.com/th/id/R.be080585c0da64067404b23530a814ce?rik=vjGDbB2xFyn9Sw&riu=http%3a%2f%2fwallup.net%2fwp-content%2fuploads%2f2016%2f03%2f10%2f318375-nature-landscape-lake-mountain-forest-wildflowers-spring-pine_trees-path-Switzerland-HDR.jpg&ehk=W21nAe%2fQYSWkLQF83VxX2RflaJ7eKm%2fm0J4pW85PpjU%3d&risl=&pid=ImgRaw&r=0"
alt>
</li>
<li class="splide__slide">
<img
src="https://th.bing.com/th/id/R.7554469478facf078b3de643749f06d9?rik=J7govmz%2bm%2fAQYQ&pid=ImgRaw&r=0"
alt>
</li>
</ul>
</div>
</section>
<script>
var splide = new Splide( '.splide', {
type : 'loop',
padding: '3rem',
height: '800px',
gap : 20,
} ).mount();
</script>
tried modifying the code but didnt change in the way i want. instead what i tried, just shows the image/next image beneath the main one.
2
Answers
I think the images should be width 100%. Yes that helped. Also, don’t forget the units for the
gap
property.As I have been looking through your code I added the responsiveness for the images , just to be sure they are displayed correctly in the block with the width 100% , as it seems to be a probleme there and then I have also included the .js and .css library for the splide , because it wasn’t there and as far as I know it might be the mistake because of it is not working. Also added the ‘px’ next to the gap , to make it clear for the parser to recognise it.
Hope it helps Bruder , have a nice day 🙂