Show the content within the carousel indicators div

I'm working with a bootstrap carousel that has 3 tabs and I want to name them Step 1, Step 2, and Step 3.

Even though I've placed these names in the carousel-indicator divs, they are not showing up. Any assistance on this issue would be greatly appreciated.

<style>
.carousel-indicators {
  display: flex!important;
  position: inherit!important;
  justify-content: space-between!important;
}

.carousel-indicators [data-bs-target] {flex: 1 0 auto!important;} 
.carousel-indicators {  margin-left: auto!important;  margin-right: auto!important;}


.carousel-indicators .active {
 border-bottom: blue 5px solid!important;
}

.page{
    height:50px!important;
    background:#efefef!important;
    margin:0px!important;
}
</style>

<link href="https://cdn.jsdelivr.net/npm/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="74161b1b00070006150434415a465a46">[email protected]</a>/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-Zenh87qX5JnK2Jl0vWa8Ck2rdkQ2Bzep5IDxbcnCeuOxjzrPF/et3URy9Bv1WTRi" crossorigin="anonymous">

<script src="https://cdn.jsdelivr.net/npm/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="2c4e4343585f585e4d5c6c19021e021e">[email protected]</a>/dist/js/bootstrap.bundle.min.js" integrity="sha384-OERcA2EqjJCMA+/3y+gxIOqMEjwtxJY7qPCqsdltbNJuaOe923+mo//f6V8Qbsw3" crossorigin="anonymous"></script>

<div class="accordion" id="accordionExample">
  <div class="accordion-item">
    <h2 class="accordion-header" id="headingOne">
      <button class="accordion-button" type="button" data-bs-toggle="collapse" data-bs-target="#collapseOne" aria-expanded="true" aria-controls="collapseOne">
        <input class="workflowTitle" value="Accordion Item #1" />
      </button>
    </h2>
    <div id="collapseOne" class="accordion-collapse collapse show" aria-labelledby="headingOne" data-bs-parent="#accordionExample">
      <div class="accordion-body">

        <div id="carouselExampleDark" class="carousel carousel-dark slide" data-bs-ride="false" data-bs-interval="false">

          <div class="carousel-indicators">



            <div type="button" data-bs-target="#carouselExampleDark" data-bs-slide-to="0" class="page active" aria-current="true" aria-label="Slide 1">Step1</div>
            <div type="button" data-bs-target="#carouselExampleDark" data-bs-slide-to="1" class="page" aria-label="Slide 2">Step2</div>
            <div type="button" data-bs-target="#carouselExampleDark" data-bs-slide-to="2" class="page" aria-label="Slide 3">Step3</div>




          </div>

          <div id="carouselExampleControls" class="carousel slide" data-bs-ride="false" data-bs-wrap="false">
            <div class="carousel-inner">
              <div class="carousel-item active">
                <p class="d-block w-100">Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old. Richard McClintock, a Latin professor at Hampden-Sydney College in Virginia, looked up one of the more obscure Latin words, consectetur, from a Lorem Ipsum passage, and going through the cites of the word in classical literature, discovered the undoubtable source. Lorem Ipsum comes from sections 1.10.32 and 1.10.33 of "de Finibus Bonorum et Malorum" (The Extremes of Good and Evil) by Cicero, written in 45 BC. This book is a treatise on the theory of ethics, very popular during the Renaissance. The first line of Lorem Ipsum, "Lorem ipsum dolor sit amet..", comes from a line in section 1.10.32.



                </p>
                <div class="carousel-caption d-none d-md-block">
                </div>
              </div>
              <div class="carousel-item">
                <p class="d-block w-100">Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.



                </p>
                <div class="carousel-caption d-none d-md-block">
                </div>
              </div>
              <div class="carousel-item">
                <p class="d-block w-100">It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using 'Content here, content here', making it look like readable English. Many desktop publishing packages and web page editors now use Lorem Ipsum as their default model text, and a search for 'lorem ipsum' will uncover many web sites still in their infancy. Various versions have evolved over the years, sometimes by accident, sometimes on purpose (injected humour and the like).
                </p>
                <div class="carousel-caption d-none d-md-block">
                </div>
              </div>
            </div>

            <button class="btn btn-light" type="button" data-bs-target="#carouselExampleDark" data-bs-slide="prev">
            <span class="">Previous</span>
          </button>
            <button class="btn btn-light" type="button" data-bs-target="#carouselExampleDark" data-bs-slide="next">

            <span class="">Next</span>
          </button>
          </div>
        </div>
      </div>
    </div>
  </div>

Answer №1

The content is currently hidden due to the text-indent property being set to -999px. To make the text visible, you can modify the indicator with the target attribute using the following code:

.carousel-indicators [data-bs-target] { text-indent: 0!important; }
.

Below, you can observe this solution in action along with some additional styles that have been applied to center the text. Please note that not all styles may be necessary, so feel free to adjust as needed.

.carousel-indicators [data-bs-target] {
  flex: 1 0 auto!important;
  text-indent: 0!important;
  display: flex!important;
  justify-content: center!important;
  align-items: center!important;
}

I have used !important in the examples for consistency with the code style, but ideally, it's recommended to minimize the use of !important and instead enhance specificity through other means. You can refer to How do I avoid using !important? and https://developer.mozilla.org/en-US/docs/Web/CSS/Specificity for more information.

.carousel-indicators {
  display: flex!important;
  position: inherit!important;
  justify-content: space-between!important;
}

.carousel-indicators [data-bs-target] {
  flex: 1 0 auto!important;
  text-indent: 0!important;
  display: flex!important;
  justify-content: center!important;
  align-items: center!important;
}

.carousel-indicators {
  margin-left: auto!important;
  margin-right: auto!important;
}

.carousel-indicators .active {
  border-bottom: blue 5px solid!important;
}

.page {
  height: 50px!important;
  background: #efefef!important;
  margin: 0px!important;
}
<link href="https://cdn.jsdelivr.net/npm/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="c5a7aaaab1b6b1b7a4b585f0ebf7ebf7">[email protected]</a>/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-Zenh87qX5JnK2Jl0vWa8Ck2rdkQ2Bzep5IDxbcnCeuOxjzrPF/et3URy9Bv1WTRi" crossorigin="anonymous" />

<script src="https://cdn.jsdelivr.net/npm/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="1d7f7272696e696f7c6d5d28332f332f">[email protected]</a>/dist/js/bootstrap.bundle.min.js" integrity="sha384-OERcA2EqjJCMA+/3y+gxIOqMEjwtxJY7qPCqsdltbNJuaOe923+mo//f6V8Qbsw3" crossorigin="anonymous"></script>

<div class="accordion" id="accordionExample">
  <div class="accordion-item">
    <h2 class="accordion-header" id="headingOne">
      <button class="accordion-button" type="button" data-bs-toggle="collapse" data-bs-target="#collapseOne" aria-expanded="true" aria-controls="collapseOne">
        <input class="workflowTitle" value="Accordion Item #1" />
      </button>
    </h2>
    <div id="collapseOne" class="accordion-collapse collapse show" aria-labelledby="headingOne" data-bs-parent="#accordionExample">
      <div class="accordion-body">
        <div id="carouselExampleDark" class="carousel carousel-dark slide" data-bs-ride="false" data-bs-interval="false">
          <div class="carousel-indicators">
            <div type="button" data-bs-target="#carouselExampleDark" data-bs-slide-to="0" class="page active" aria-current="true" aria-label="Slide 1">
              Step1
            </div>
            <div type="button" data-bs-target="#carouselExampleDark" data-bs-slide-to="1" class="page" aria-label="Slide 2">
              Step2
            </div>
            <div type="button" data-bs-target="#carouselExampleDark" data-bs-slide-to="2" class="page" aria-label="Slide 3">
              Step3
            </div>
          </div>

          <div id="carouselExampleControls" class="carousel slide" data-bs-ride="false" data-bs-wrap="false">
            <div class="carousel-inner">
              <div class="carousel-item active">
                <p class="d-block w-100">
                  Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old. Richard McClintock, a Latin professor at Hampden-Sydney College in Virginia, looked up
                  one of the more obscure Latin words, consectetur, from a Lorem Ipsum passage, and going through the cites of the word in classical literature, discovered the undoubtable source. Lorem Ipsum comes from sections 1.10.32 and 1.10.33 of
                  "de Finibus Bonorum et Malorum" (The Extremes of Good and Evil) by Cicero, written in 45 BC. This book is a treatise on the theory of ethics, very popular during the Renaissance. The first line of Lorem Ipsum, "Lorem ipsum dolor sit
                  amet..", comes from a line in section 1.10.32.
                </p>
                <div class="carousel-caption d-none d-md-block"></div>
              </div>
              <div class="carousel-item">
                <p class="d-block w-100">
                  Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has
                  survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently
                  with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
                </p>
                <div class="carousel-caption d-none d-md-block"></div>
              </div>
              <div class="carousel-item">
                <p class="d-block w-100">
                  It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using 'Content here,
                  content here', making it look like readable English. Many desktop publishing packages and web page editors now use Lorem Ipsum as their default model text, and a search for 'lorem ipsum' will uncover many web sites still in their infancy.
                  Various versions have evolved over the years, sometimes by accident, sometimes on purpose (injected humour and the like).
                </p>
                <div class="carousel-caption d-none d-md-block"></div>
              </div>
            </div>

            <button class="btn btn-light" type="button" data-bs-target="#carouselExampleDark" data-bs-slide="prev">
              <span class="">Previous</span>
            </button>
            <button class="btn btn-light" type="button" data-bs-target="#carouselExampleDark" data-bs-slide="next">
              <span class="">Next</span>
            </button>
          </div>
        </div>
      </div>
    </div>
  </div>
</div>

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

What is the correct way to send parameters in the action tag?

Can I set the res variable as the form action in HTML? <script> var name =$("#name").val(); var file =$("#file").val(); var res= localhost:8080 + "/test/reg?&name="+name+"&file=" +file ; </script> <form acti ...

Experiencing issues with connecting to jQuery in an external JavaScript file

My jQuery formatting in the HTML file looks like this: <!doctype html> <html lang="en"> <head> <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js" type="text/javascript"></script> </head> < ...

Determining the condition of the menu: understanding whether it is open or closed

I'm diving into the world of jQuery and JavaScript, trying to grasp the ins and outs of the mmenu API. Despite my efforts to understand the libraries, the JavaScript code remains a mystery to me. Following the tutorial provided on , I successfully cr ...

The plugin data containing 'data:application/pdf;base64,JVBERi0xLjQKJ**' was declined for loading. Content security policy cannot be configured

My approach to enforcing content security policy involves using the following code snippet: <meta charset="UTF-8" http-equiv="content-security-policy" content="object-src 'self' data:" /> However, when this i ...

The sidebar scrolling feature seems to be malfunctioning, as only the page scrolling functionality is currently

I'm currently working on a webpage that features a sidebar, along with other elements as shown below: https://i.sstatic.net/gf7dX.png In this design, the Your Friends section represents the sidebar. However, I have noticed that when I hover over the ...

Issues with linking in Codeigniter

For my college project, I decided to use the codeigniter framework. However, I am facing some issues with links. When I attempt to include a link within an array, like so: <li> <a href="<?php echo site_url('Controller_test/testFunctio ...

Encountered a problem loading resources - code 500 malfunction detected

I am encountering an issue where I consistently receive a 500 Internal Server Error message in the developer console for all CSS, image, and JS files: Failed to load resource: the server responded with a status of 500 (Internal Server Error) Despite doub ...

The new FormData(form) method unexpectedly returns an empty object

In this scenario, I am aiming to retrieve key-value pairs. The form on my page looks like this: <form id="myForm" name="myForm"> <label for="username">Enter name:</label> <input type="text" id="username" name="username"> ...

What is the best way to achieve vertical text box scrolling in CSS and HTML overflow?

I'm having an issue with a text box I created and I couldn't find a solution elsewhere. Here is the CSS script for the text box: css: .cln{ top:220px; width:680px; height:350px; text-align:left; overflow:scroll; white-space: nowrap; overflow: ...

What is the process for transferring a file's contents to my server?

I am currently working on allowing users to import an OPML file that I parse server-side in my Rails application. However, I am facing difficulties as it appears that my server is not receiving the information correctly (neither the success nor error funct ...

Ensure the item chosen is displayed on a single line, not two

I've encountered an issue with my select menu. When I click on it, the options are displayed in a single line. However, upon selecting an item, it appears on two lines - one for the text and another for the icon. How can I ensure that the selection re ...

Mixing Module Federation with different React versions and individual CSS isolation

In my setup, the module federation remote repository is: developed using react 17 utilizing material-ui 4 with jss incorporating global CSS from third-party libraries that cannot be modified Meanwhile, I have several hosts that consist of: different ver ...

Conceal the div using a sliding left animation

After researching extensively, I have been unable to find a solution to my problem. In order to better illustrate my issue, here is the code for reference: jsfiddle I am looking to create a sliding effect for a calc div where it moves to the left, simila ...

Revamping the navbar hover effect icon

I am currently working on customizing the navigation bar on my website. I have created a code snippet that adds a small '+' sign next to any link that has sub-options. When the user hovers over the link, the '+' sign changes to a ' ...

Ensure the menu bar remains at the top of the page without using the position:

Check out this awesome fiddle here! My menu bar looks great at the top, but for some reason it won't stay in place when the user scrolls down. I've tried adding position:fixed to the CSS under the first #cssmenu, but it messes everything up. Her ...

Display or conceal nested divs within ng-repeat loop

I set up a div with sub divs to establish a nested grid system. There are three levels altogether: MainDiv - Always Visible SecondDiv - Display or conceal when MainDiv is clicked on ThirdDiv - Display or conceal when SecondDiv is clicked on <div c ...

Substitute link with asynchronous JavaScript and XML

I need to enable/disable user accounts by clicking on an anchor. The list of users is created dynamically using a loop. Here's an example of an anchor tag: <a href="http://www.example.com/users/deactivate/44" class="btn btn-success" title="Deactiv ...

Utilizing a loop for setting variable values in JavaScript

Using both JavaScript and JQuery. Let's imagine there is an array called ListArray with various sentences inside. Sounds easy enough. Is there a way to achieve this? var List = for (var i = 0; i < 10; i++) { //iterate over an array here to c ...

When using ContentEditable in Firefox, it generates double line breaks instead of a single one

Noticed an interesting issue with div contenteditable where Firefox is interpreting 1 newline as 2 newlines. Is this a bug or am I overlooking something? Test it out in the example below by typing: Hello World within the contenteditable. When accessi ...

Experience the captivating AUTOPLAY feature of the mesmerizing FULLSCREEN SLIT SL

I am currently utilizing a slider that is functioning well, however I am encountering an issue with autoplay. Whenever I click on the navigation arrow or Nav dot at the bottom of the slider, the autoplay feature stops working. For more information, please ...