I want to add space between two slick carousel items, but not want the space with padding, because it\'s reducing my element size(and I don\'t want that).
Try to use pseudo classes like :first-child & :last-child to remove extra padding from first & last child.
Inspect the generated code of slick slider & try to remove padding on that.
Hope, it'll help!!!
Since the latest versions you can simply add a margin
to your slides:
.slick-slide {
margin: 0 20px;
}
There's no need for any kind of negative margins, since slick's calculation is based on the elements outerHeight
.
simply add padding on to the slick-side class will do
.slick-slider .slick-slide {
padding: 0 15px;
}
@Dishan TD's answer works nice, but I'm getting better results using only margin-left.
And to make this clearer to everyone else, you have to pay attention to the both opposite numbers: 27 and -27
/* the slides */
.slick-slide {
margin-left:27px;
}
/* the parent */
.slick-list {
margin-left:-27px;
}
If you want a bigger space between the slides + not to decrease the slide's width, it means you'll have to show less slides. In such case just add a setting to show less slides
$('.single-item').slick({
initialSlide: 3,
infinite: false,
slidesToShow: 3
});
Another option is to define a slide's width by css without setting to amount of slides to show.
With the help of pseudo classes removed margins from first and last child, and used adaptive height true in the script. Try this fiddle
One more Demo
$('.single-item').slick({
initialSlide: 3,
infinite: false,
adaptiveHeight: true
});