Creating a Bootstrap carousel with a caption placed on the right side - here's how!


How can I get the caption to appear on the right side instead of the left side?

Here is the CSS code I am using:

#jumboCarousel {
    margin-top: 70px;
    min-height: 300px;
    max-height: 600px;
    min-width: 100%;
}
#jumboCarousel img {
    min-height: 300px;
    max-height: 600px;
    min-width: 100%;
}
#jumboCarousel > .carousel-indicators > li {
    border-radius: 0px;
    min-width: 25px;
    background-color: #9d9d9d;
    border: 1px solid black;
    margin-right: 10px;;
    margin-left: 10px;;
}
#jumboCarousel > .carousel-indicators > .active {
    background-color: orange;
}
#jumboCarousel .carousel-caption {
    color: white;
    xright: 58%;
    text-align: center;
    max-width: 300px;
    right: 0;
    top: 1px;
    /*top: 50%; */
    xtransform: translateY(-50%);
    xbottom: initial;
    background: rgba(0,0,0,0.5);
    padding:10px;
    height:100%;

}

.item {
    -webkit-transform-style: preserve-3d;
    -moz-transform-style: preserve-3d;
    transform-style: preserve-3d;
}

To see the issue in action, visit my codepen: https://codepen.io/mrsalami/pen/VdeGYK?editors=1100

Answer №1

To fix the issue, simply include the following code snippet: left: auto; within the #jumboCarousel .carousel-caption element.

#jumboCarousel .carousel-caption {
    color: white;
    text-align: center;
    max-width: 300px;
    right: 0;
    top: 1px;
    xtransform: translateY(-50%);
    xbottom: initial;
    background: rgba(0,0,0,0.5);
    padding: 10px;
    height: 100%;
    left: auto; /*Added*/
}

Answer №2

It appears that the issue lies in the presence of a left:20%; value within the .carousel-caption class.

To resolve this, simply add left:initial;

    #jumboCarousel .carousel-caption {left:initial;}

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

Center text vertically within a Bootstrap anchor element (button)

I am facing difficulty in vertically aligning text within a Bootstrap (3) <a> element while it works fine in a <button> Here is the HTML : <button class="btn">some text<span class="glyphicon glyphicon-play pull-right"></span> ...

How can I display different divs based on a selected option?

I'm encountering difficulties while attempting to develop the code for this specific task. My goal is to display or hide divs based on the selection made in a select option, with a total of 4 options available. There are 2 select elements <select ...

What is the best way to choose a radio button when the page loads and extract its value at

After successfully setting a radio button to be selected upon page load, I am now facing the challenge of displaying the value of that button without the need to click on it. My goal is to toggle the visibility of different div elements, with the initial ...

A guide on creating a clickable polygon in Vue.js using Konva

Is there a way to create an interactive polygon in Vue Konva where I can set each corner with a click? I haven't been able to find any resources other than the v-polygon which only creates predefined polygons. ...

Concealing the navigation bar toggle button on larger and medium-sized devices

Struggling to create a responsive website with bootstrap, I am working on a navbar that should only display a toggle button on small-scale devices. Even after assigning a visible-sm class to hide the button, it remains visible on all screen sizes. I need ...

What is the best way to implement a media query for changing styles on hover for an element

I am facing an issue with media queries where when I apply a hover effect to an element, such as a clickable link in the navigation bar, the new rules work as expected but also retain the default browser styles. For instance: nav ul li a:hover{ border:0; ...

What is the best way to customize the appearance of the initial row in each tr cluster?

Looking to add a button for expanding child rows within a datatable, with each group in the table having the same child elements.... The provided CSS currently displays the icon on every row throughout the entire table. td.details-control { backg ...

Is it possible for Javascript to manipulate the DOM of an Ajax text/html response?

My goal is to implement Ajax to retrieve an HTML page and extract a specific div by its ID, then insert that div into the current page. This involves loading a second page via Ajax, extracting the specified div from the response, and placing it within th ...

The Opera browser displays a horizontal orientation for vertical menus

Having some trouble with my vertical menu rendering correctly in different browsers. It's appearing horizontal in Opera, but looks good in Firefox and Chrome. I'm pretty sure it's just a small tweak needed in the code, but I can't quite ...

jQuery allows you to dynamically add a link that can remove a control in a unique

I am facing an issue with generating controls and removing them dynamically. I am trying to include a 'Link' that will trigger a function to remove the dynamically created control. The control and link are placed next to each other. Below is the ...

The utilization of HTML in Laravel for generating PDF documents

I'm currently in the process of developing a website using Laravel, where I need to include a functionality that allows users to download a PDF containing details related to the specific page they are viewing (such as a training course). For this pur ...

Encountering an unspecified variable in Sass

I am a beginner in the world of sass and I am trying to incorporate a variable from a file named "_designs.scss" into another file called "_component.scss". Despite my efforts, I keep encountering an "Undefined variable: $grey-light-2" error. I have exhaus ...

The Angular carousel fails to display or operate properly

I am encountering an issue where the content is not displaying when using the angular-carousel directives: <ul rn-carousel rn-carousel-controls rn-carousel-index="carouselIndex" rn-carousel-buffered > <li ng-repeat="slide in slides track by ...

Stop Bootstrap from impacting a specific division on my webpage

Is there a way to stop Bootstrap from impacting a specific div and its nested divs in my HTML document? Since adding Bootstrap, the images inside this particular div have turned dull and acquired an undesirable blue tint. Thank you for considering my conce ...

An error occured upon loading FullCalendar: Uncaught TypeError - Unable to read property 'push' as it is undefined

First of all, thank you for your assistance. I've been trying to load FullCalendar (https://fullcalendar.io/) on my development environments but it doesn't seem to be working. When I check the console in Chrome, it shows me the following error m ...

Extract the raw text content from nested elements

Working with highlight.js to include a custom CSS code, however, this library automatically adds span tags around the desired text For example: <pre> <code class="language-css hljs" contenteditable="true" id="css-code&quo ...

What is the process for incorporating themes into CSS?

At the moment, I have set up variables to manage colors for both light and dark themes (such as --light-background-color, --dark-background-color). Handling two themes is manageable with this approach, but it feels a bit labor-intensive. If more themes wer ...

What is the process for incorporating a personalized SVG file into the material-ui Icon Component?

For my project, I have a requirement to use custom svg files. To achieve this, I am utilizing <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="0865697c6d7a616964257d61483b2631263b">[email protected]</a>. I reviewed ...

Words placed in the middle of the picture

<div> <img style="vertical-align:middle" src="https://placehold.it/60x60"> <span style="">New Product</span> </div> I require this specific layout to be responsive. Could you please provide instructions on achieving this? ...

"Shuffle the Order of Divs Each Time the Page Loads

I have multiple divs labeled as "gallerycard". I want them to appear in a different random order each time the page is loaded. <div id="gallerycard"> <div id="name">Akulina</div> <div id="info">N/A</div> </div> ...