Having trouble aligning a div in the middle of a slick-slider item using flex styling

I've created a slick slider component in Vue, and I'm facing an issue with centering a circular div inside each of the slider items. Despite trying to align and justify center along with adding margin:auto for horizontal centering, I can't seem to achieve vertical centering. Any suggestions on how I can resolve this? Could it be related to how slick slider adjusts the width of the slick items through 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>

Answer №1

You may want to consider using the !important declaration on the display property for SLIDERcontainer6_item_container.

.SLIDERcontainer6_item_container {
    display: flex !important;
}

It appears that the slider library is taking precedence over the display property.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Connecting to a specific mui-tab with react-router-dom

How can I link to a specific tab in my material ui-based tabs setup within a React application? I want to be able to navigate directly to a particular tab when landing on the page, but I'm struggling with integrating this functionality. Is there a way ...

The process of JavaScript for detecting and extracting text from

After much searching, I stumbled upon this intriguing piece of JavaScript code at this location. Curiously, I was able to remove a few eggs using the following script: var eggCoordinates = []; for (var i = 0; i < 5; i++) { eggCoordinates.push(new E ...

The react transition group fails to add the necessary CSS classes to the specified div

Regardless of whether I utilize React transition group, Tailwind, pure CSS, or any other framework, no transitions seem to occur when I structure my simple component in the following manner. I have experimented with various frameworks, but the outcome rema ...

Generate nth-child selectors in a Material-UI component using props dynamically

I am currently working on customizing the Material UI slider component, specifically focusing on its marks prop to display the number of occurrences for each data object within the marks array. The desired appearance of the slider is illustrated in this i ...

Errors occur when using jQuery Autocomplete alongside Angular HTTP

I have implemented an ajax autocomplete feature for my database using the jQuery-Autocomplete plugin. Below is my current code setup: HTML: <input ng-keyup="searchCustomer()" id="customerAutocomplete" type="text"> Angular $scope.searchCustome ...

Encountered an issue when attempting to select the password field in order to log into a Google account using

Having some trouble automating the login process for my Gmail account. Managed to find the email element with an ID, but hitting a roadblock trying to locate the Password element as it doesn't have an ID. Here's what I've attempted: passw ...

The JavaScript setTimeout function not triggering repetitively for 10 instances

I'm facing an issue with a JavaScript/jQuery function that is designed to call itself multiple times if there is no available data. This is determined by making a web service call. However, the logging inside the web service indicates that it is only ...

When running the command "npx create-next-app@latest --ts," be aware that there are 3 high severity vulnerabilities present. One of the vulnerabilities is that "node-fetch

Just set up a fresh project with Next.js and TypeScript by following the documentation using npx create-next-app@latest --ts. Encountering multiple high severity vulnerabilities despite running npm audit fix --force, which actually adds more vulnerabiliti ...

I possess a JSON object retrieved from Drafter, and my sole interest lies in extracting the schema from it

Working with node to utilize drafter for generating a json schema for an application brings about too much unnecessary output from drafter. The generated json is extensive, but I only require a small portion of it. Here is the full output: { "element": ...

Issue with updating input value during keyup event in Android Chrome specifically

Check out this straightforward jsfiddle: https://jsfiddle.net/gq9jga4q/33/ <input type="text" id="kbdhook" /> <div id="result" >1: </div> <div id="result2" >2: </div> <div id="result3" >3: </div> $('#kbdh ...

Show the chosen value from the dropdown menu on all JSP pages

I have a header.jsp file containing a dropdown box labeled "Role". This header.jsp is designed to be included in all other JSP files using a directive. Once a user logs in, they are directed to a homepage where they must select a value from the dropdown ...

How can I modify the # symbol with .htaccess?

When someone accesses the following URL: www.facebook.com/index.php#sk=inbox The .htaccess file will redirect it to the server as: www.facebook.com/index.php?sk=inbox This allows me to retrieve the value of sk using PHP like this: *echo $_GET[&a ...

What is the best way to incorporate a custom string into an Angular application URL without disrupting its regular operation?

In my Angular application with angular ui-router, I am facing an issue with the URL structure. When I access the application from the server, the URL looks like localhost/..../index.html. Once I click on a state, the URL changes to localhost/.../index.htm ...

Utilizing jQuery to place an element beside another and maintain its position

I need ElementA to be positioned next to ElementB as shown in this example. The key difference is that I want ElementA to move along with ElementB if the latter is relocated. Is there a way to keep a specific element fixed to another one? Re-calculating ...

How can JavaScript allow access to files outside of a web server environment? Could .htaccess provide a

Currently, I'm facing a challenge with my local server on Mac 10.8. I am trying to serve files such as videos and images from an external hard drive. The path for the external hard drive is HD: /Volumes/ while the web server's path is /Library/Se ...

The value of the cookie is not set (version 2.0.6 of react-cookie)

I am encountering an issue with implementing react cookies version 2. I am using webpack-dev-server for testing. Below is the console log: Warning: Failed context type: The context cookies is marked as required in withCookies(App), but its value is unde ...

Tips for preventing child elements from becoming distorted when the parent element is resized

How can I prevent rotated child elements from skewing when the parent element is scaled? Here is the code snippet that I am working with: <svg viewbox="0 0 500 500"> <g class="parent" transform="matrix(1.71341 0 0 1 -42.302 0)"> <path ...

Can you explain the purpose of the yarn command --prefer-offline?

After installing an npm package like react for the first time using yarn add react I noticed that the .yarn-cache folder contains many files. I assume this is where yarn stores the local cache, so when I install react again in the future, it will be pulle ...

Uncovering components generated by React JS with BeautifulSoup

My goal is to extract anchor links with the class "_1UoZlX" from the search results on a specific page - After analyzing the page, I realized that the search results are dynamically generated by React JS and not readily available in the page source or HTM ...

Is there a quicker alternative to the 500ms delay caused by utilizing Display:none?

My div is packed with content, including a chart from amCharts and multiple sliders from noUiSlider. It also features various AngularJS functionalities. To hide the page quickly, I use $('#container').addClass('hidden'), where the rule ...