Hi,
Wrap it in another div, give that div 100% and try to center its contents. I assume you are talking about tailwindcss? If that does not work try to enclose it container maybe?
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hi everybody, I made a slick slider component in vue, I'm trying to center a circular div inside each one of the slider items but I can't get tit to work, it centers horizontally after I added margin:auto but it doesn't center vertically despite using align and justify center, any idea how I can get this to work? I think it has something to do with how slick slider changes the width of the slick items via javascript...
<template>
<slick class="SLIDERcontainer6_maincontainer" ref="slick" :options="slickOptions">
<div class="SLIDERcontainer6_item_container" v-for="slider in globals.producsSlider" :key="slider.title">
<div class="SLIDERcontainer6_item_image" :style="'background-image:url('+slider.image+');'"></div>
</div>
</slick>
</template>
<!--SCRIPTS-->
<script>
import { mapState } from 'vuex';
import Slick from 'vue-slick';
export default {
name: 'SLIDERcontainer10',
components: { Slick },
computed:
{
...mapState('Globals',['globals'])
},
data()
{
return {
slickOptions: {
infinite: true,
slidesToShow: 4,
slidesToScroll: 1,
prevArrow: '<i class="fa fa-chevron-left fs_bigger c_light" style="position:absolute; left:10px; top:50%; transform:translateY(-50%); z-index:99999;"></i>',
nextArrow: '<i class="fa fa-chevron-right fs_bigger c_light" style="position:absolute; right:10px; top:50%; transform:translateY(-50%); z-index:99999;"></i>',
arrows: true,
autoplay: true,
speed: 2000,
autoplaySpeed: 4000,
responsive:
[
{
breakpoint: 1120,
settings:
{
slidesToShow: 3,
slidesToScroll: 1,
}
},
{
breakpoint: 800,
settings:
{
slidesToShow: 2,
slidesToScroll: 2
}
},
{
breakpoint: 600,
settings:
{
slidesToShow: 1,
slidesToScroll: 1
}
}]
},
};
},
beforeUpdate()
{
if (this.$refs.slick) {
this.$refs.slick.destroy();
}
},
updated()
{
this.$nextTick(function () {
if (this.$refs.slick) {
this.$refs.slick.create(this.slickOptions);
}
});
},
mounted()
{
console.log(this.$options.name+' component successfully mounted');
},
};
</script>
<!--STYLES-->
<style scoped>
.SLIDERcontainer6_maincontainer{width:100%; height:auto; position:relative;}
.SLIDERcontainer6_item_container{width:33.33%; height:350px; display:flex; flex-direction:column; align-items:center; justify-content:center; background-color:var(--web_primary_color); position:relative;}
.SLIDERcontainer6_item_image{width:275px; height:275px; border-radius:50%; background-size:cover; background-position:center; margin:auto; align-self:center;}
@media only screen and (max-width: 736px)
{
}
</style>
Please or to participate in this conversation.