Utilizing CSS for multiple carousels while applying unique styles to each one individually

I am currently working on modifying the code below so that it will only execute when a specific class is linked to the carousel. There are multiple carousels present on the same page.

@media (min-width: 576px) and (max-width: 768px) {
  /* Display the 3rd slide on small screens if col-sm-6 is active */
    .carousel-inner .active.col-sm-6.carousel-item + .carousel-item + .carousel-item {
        position: absolute;
        top: 0;
        right: -50%;  /* This part may be altered with JavaScript in future */
        z-index: -1;
        display: block;
        visibility: visible;
    }

<div id="carousel-example" class="carousel slide" data-ride="carousel" data-interval="2000">
                    <div class="carousel-inner row w-100 mx-auto" role="listbox">
                        <div class="carousel-item col-12 col-sm-6 col-md-4 col-lg-3 active">
                            <img src="assets/img/car_logos/car_logo_PNG1636.png" class="img-fluid mx-auto d-block contain" alt="img1">
                    </div>

Answer №1

Have you considered using a selector or a class instead of doing it this way? If you need more customization and control over carousel items, I recommend checking out the Owl Carousel.

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

Is it possible to parameterize the adding of classes in jQuery?

Is it feasible to parameterize the jQuery addClass() function to set specific CSS properties when called? For example, applying a color property to a CSS class when addClass() is invoked? I am relatively new to JavaScript and CSS, so any guidance would be ...

Adding CSS style to an Image Resource in GWT: a step-by-step guide

Currently working with GWT and have an Image Resource object in use. For instance, ImageResource image = ClientResources.of().images().icon(); Looking to add some CSS styles to this image, however being that it's an ImageResource and not an Image o ...

Enable scrolling feature for the table

I have integrated a bootstrap table into my React application, but I am facing an issue where the table is not scrollable. Whenever new content is loaded, it increases the height of the table instead of making it scrollable. Below is the code for my table ...

Main content with a floating aside menu

I am currently using the CoreUI admin template. The layout I have set up is the basic one outlined on the following page: My goal is to make the aside menu appear on the right side of the main content, floating over it rather than inline and reducing the ...

The color of the last clicked DIV is supposed to stay permanent, but for some unknown reason

I'm attempting to replicate this design in my project: http://jsfiddle.net/AYRh6/26/ However, I am facing issues with it and cannot pinpoint the exact problem in the code. I am using code for a toggle effect. Any assistance would be greatly appreciat ...

How to retrieve the image source using jQuery

<img src="../img/arnold.png" alt="Arnold"> Is there a way to retrieve the absolute path of this image using jQuery? Currently, when I use img.attr("src"), it only returns "../img/arnold.png", but I need it to return something like "http://site.com/ ...

After pressing the login button, my intention is to transition to a different page

I am relatively new to web development and working with angular. I have a login component that, upon hitting the LOGIN button, should redirect to another component on a different page. However, currently, when I click the button, it loads the data of the o ...

Is there a way for me to adjust column widths in bootstrap using only CSS, without being able to modify the HTML code?

<div class="col-12 col-md-7">column md-7</div> <div class="col-12 col-md-1">spacer md-1</div> <div class="col-12 col-md-4">column md-4</div> Recently, I took on a volunteering opportunity to revamp a webpage for an upco ...

Is there a problem with Chrome's display?

I'm currently using Chrome version 53.0.2785.143 and have noticed a rendering issue that tends to occur more frequently within my application when utilizing CSS transform scale. Feel free to check out this JSFiddle link which demonstrates the problem ...

Located at the lower section of the parent container

In my flex container, I have two boxes arranged side by side (collapsing into one column on smaller screens). I've ensured that these boxes have the same height when displayed together, as shown in the image below: https://i.sstatic.net/ZjsfW.png No ...

Adjusting AngularJS scroll position based on key presses

I am currently working on an autocomplete feature using AngularJS. I seem to be experiencing a problem with the scrollbar behavior. In the interactive gif provided, you can observe that the scrollbar remains stationary when navigating with the arrow keys. ...

Issues with CSS rotation not functioning as intended

Seeking assistance with CSS animation: How can I make the elements :before rotate? Link to code on jsFiddle CSS .footerLink{ padding:20px; background:#000; color:#fff; } .footerLink:before{ content:'ABC'; margin-right:15px; ...

Struggling to make the CSS :not() selector function correctly as needed

I've been struggling to make the CSS :not() selector work in a specific way and despite searching for solutions, I haven't been successful. I came across some helpful resources like this page, but I couldn't figure it out on my own. Hopefull ...

Why is the last move of the previous player not displayed in this game of tic tac toe?

Why does the last move of the previous player not show up in this tic-tac-toe game? When it's the final turn, the square remains empty with neither an "O" nor an "X". What could be causing this issue? Here is the code snippet: The HTML code: <div ...

What does the term "root element" refer to in the Material-UI documentation?

I am finding the terminology used in material ui confusing and would appreciate if someone could clarify it for me. For example, let's consider this information from https://material-ui.com/guides/api/: Spread Undocumented properties supplied ar ...

Steps for compiling SCSS to CSS using Angular-CLI and moving it to the assets directory

I am currently working on an Angular 5 project with an assets folder where I store my common CSS file and reference it in index.html. I now plan to create a new folder called "sasstyles" and place some .scss files there. When I compile or run the project ...

What is the best way to extend a floated element to completely occupy the vertical space within the viewport?

Creating a help system using Bootstrap. The goal is to have the left navigation fill the vertical space, regardless of the size of the menu or content. In addition, the footer should remain at the bottom of the page when there is minimal content but shoul ...

Trouble with Setting a Background Image in Ionic with Javascript and Angular

I'm having trouble getting my background image to display in this Ionic project using CSS. It works when I embed it directly into the HTML, but that's not an ideal solution. I vaguely recall something about using base64 for images, but I'm n ...

Chrome 83 introduces an update to new form styling with customizable color options

Following the recent Chrome update, default form styling has seen an improvement in Chrome. The post suggests that it should be feasible to customize this form theme to align with a website's color scheme. Our goal was to achieve a beautiful, web-f ...

Step-by-step guide on achieving 100% height for the <main> element in a Material UI drawer demo

I have a question regarding the Material UI drawer. In my project, I am trying to change the background color of the main tag. However, the main tag's height is restricted to the content inside. Check out this link for reference Setting the height t ...