Customizing Styles in Vue3 After Importing CSS from node_modules

I'm currently working on a Vue3 application that utilizes the library https://github.com/ismail9k/vue3-carousel.

Within my App.vue file, I have included the necessary code to integrate the library:

<style>
@import "~vue3-carousel/dist/carousel.css";
</style>

However, I want to customize the default colors provided by the library.

The library sets certain colors using :root, such as:

--vc-clr-primary: #333333;
--vc-pgn-background-color: var(--vc-clr-primary);

Specifically, I am aiming to modify the following style:

.carousel__pagination-button {
  ...
  background-color: var(--vc-pgn-background-color);
}

To achieve this, I attempted to override either the variables or the class itself in my Component.vue file with the following code:

<style scoped>
.carousel__pagination-button {
  background-color: #999999 !important;
}
</style>

Unfortunately, this does not produce the desired effect.

I am open to overriding these colors anywhere since they will be consistent across the entire website. However, I am struggling to successfully apply the overrides regardless of where or how I implement them.

What could I be doing incorrectly?

Answer №1

Success!

MainApp.vue

...

<style>
#main-app {
  --custom-pagination-color: #mycolor;
}

@import "~vue3-carousel/dist/carousel-style.css";
</style>

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

Unfortunately, the header and footer are not lining up correctly with the main body on our mobile site

I've been tasked with creating a fully responsive website, but I'm encountering difficulties with the mobile design. Specifically, when I switch to mobile dimensions like an iPhone 12, the header and footer don't line up properly with the ma ...

Improve the readability of text that is overflowing using CSS styling techniques

I am facing a problem with a table containing fixed-width content that doesn't always fit within the designated space. My goal is to truncate the text to a fixed width and add an ellipsis, while allowing the full text to be visible when hovering over ...

Making Mat-Tab Table Headers Sticky in Angular

I'm facing an issue in my application where I have a screen with 3 tabs. One of these tabs contains a table with a large number of rows, and I want to make the headers of this table sticky so that they remain visible when the user scrolls down. Despit ...

Displaying wordpress submenu CSS when both the parent and child are active

On my website, I am utilizing a WordPress menu in the sidebar. My goal is to have second level child items appear only when a parent menu item is clicked. You can view an example here: I managed to use some CSS code to ensure that the Function Space sub ...

Alter the CSS of a particular ul li tag using jQuery when hovering over it

Just starting out with jQuery and struggling to accomplish my goal. Need to work with HTML only as the server doesn't support PHP or Ruby, and I'm still learning those languages. Working with the latest jQuery version 1.10.2. My issue involves a ...

What is the best way to pass a URL in Vue.js methods and activate it on @click event?

Currently, I am working on a Laravel Vue.js project where I am trying to implement a method to redirect to a link upon clicking a div element. The code snippet provided below showcases my approach. When the user clicks on the div, I want them to be direc ...

What is the best way to prevent users from clearing the value attribute of an input element?

Sample Scenario: While a user is entering information into a field, I would like to restrict the ability to delete or clear out the value, such as keeping "Friend" intact. Can this be accomplished using CSS or JavaScript? ...

Utilize a single JWT token across various Vue.js applications

Can JWT tokens be shared between several Vue.js applications that are hosted on the same domain? For instance, having a primary app for user login and transactions, and a reviews app in a subdirectory where users can only leave reviews. ...

How can you update the background image of a particular div using the 'onclick' feature in React.JS?

Thank you for helping me out here. I'm currently working with ReactJS and facing a challenge where I need to change the background of a div from a color to a specific image URL upon clicking a button in a modal. Despite my efforts, I keep encountering ...

Utilizing Treant.js within a Vue.js application

After attempting to integrate the Treant.js library into my Vue app for creating a tree diagram from JSON data, I encountered some errors. In my main view, here are the import statements... import Vue from "vue" import store from "../../store" import { ge ...

The margin-left and margin-right in HTML CSS are not cooperating to center a div

I'm currently diving into the world of CSS and HTML, but I've hit a roadblock. The margin-left and margin-right in the ".logo" div class are refusing to center the div as expected. Despite conducting research and meticulously checking over the co ...

What is the best way to align every element in a single corner using Flexbox CSS?

My goal is to place a link in each corner (left, top, right, bottom) using Flexbox. I attempted using top: 0 or adjusting the flex-direction to column. .container { position: relative; } .top { display: flex; justify-content: space-b ...

The initialization function is not being invoked

I've set up a new project using vue ui with typescript, babel, and a linter. Everything seems to be working smoothly, except I'm running into some confusion with implementing the Composition API's setup method. For some reason, it doesn&apos ...

Color overlay on top of image background

I'm struggling to create a striped colored background with a narrow center single color background on top for showcasing articles and photos. However, I am unable to get the colored background to display correctly. Despite trying different approaches ...

Including my stylesheet with a relative path to easily access the folder from any location

After successfully linking my stylesheet customstyle.css to my index.html, I encountered an issue when copying the folder to another drive - the stylesheet wouldn't get linked. How can I resolve this problem as I need to share the folder with someone ...

Utilize the trumbowyg editor in conjunction with vuejs

Recently, I incorporated the trumbowyg editor control into my Vue.js single page application. Following guidance from the documentation, I attempted to use the code snippet below to set the content of the editor. $('#editor').trumbowyg('htm ...

Is there a way to align images with text in an Outlook email template since vertical-align is not functioning properly? Are there any alternative methods

Hey there, I'm currently working on a Mail template and running into alignment issues with icons in certain versions of Outlook. It seems to be related to the Word rendering engine. Are there any alternative solutions available to ensure proper alignm ...

The arrangement of tables is influenced by the choice of font

It seems that using Google's Dosis font is causing issues with table layout: <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http:// ...

Implementing a Dynamic Navigation Feature using PHP in a Standalone File

I am currently working on creating a dynamic PHP navigation system that should highlight the active tab, but I'm facing challenges with making the active tab part function properly. While there are simpler methods available, they all involve incorpora ...

Modify the background of a div according to the size of the screen. Implement this functionality using JavaScript and

After reviewing a specific post at , I find myself unsure of how to target a particular class for reference. I am certain that I want to implement document.onload = checkWidth(); window.onresize = checkWidth(); However, I am uncertain about the procedur ...