What steps should I follow to make a dynamic carousel card with Bootstrap that adjusts to different screen sizes

My goal was to design a Bootstrap card with an embedded 'slideshow'. The idea was to use the second page to provide more information about the content on the first page. While editing this on the web, I managed to create a satisfactory product (). However, when I checked it on my phone, it appeared completely broken.

I have shared the main part of the code below, excluding the library links and some default information. I would appreciate any help or suggestions on how to fix this issue.

 <div class="row justify-content-center">
            <div class="col-sm-3">
                <div class="card text-white bg-dark mb-3" style="width: 18rem; height:24rem">
                    <div class="card-header text-muted">
                        App name
                    </div>
                    <div id="demo" class="carousel slide" data-ride="carousel">
                        <div class="card-body">
                            <!---------------------CARD BODY--------------------->
                            <!-- Indicators -->
                            <ul class="carousel-indicators">
                                <li data-target="#demo" data-slide-to="0" class="active"></li>
                                <li data-target="#demo" data-slide-to="1"></li>
                            </ul>


                            <!-- The slideshow -->
                            <div class="carousel-inner" style="height:15.2rem">

                                <div class="carousel-item active">
                                    <img class="card-img-top" src="sample.jpg"
                                         alt="Card image cap"
                                         id="sample">
                                    <h5 class="card-title">Title</h5>
                                    <h6 class="card-subtitle mb-2 text-muted">Card subtitle</h6>
                                    <p class="card-text">Hi quick example text to build on the card title and make up
                                        the bulk of the card's content.</p>

                                </div>

                                <div class="carousel-item">
                                    <h5 class="card-title">Card title</h5>
                                    <h6 class="card-subtitle mb-2 text-muted">Card subtitle</h6>
                                    <p class="card-text">Some quick example text trewrwrwerwerwero build on the card
                                        title and make up
                                        the bulk of the card's content.</p>

                                </div>
                            </div>
                            <!---------------------CARD BODY END--------------------->

                        </div>
                    </div>
                    <div class="card-footer btn btn-primary">
                        Show me!
                    </div>
                </div>
            </div>
        </div>

Answer №1

        <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css">
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js"></script>
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js"></script>

 <div class="row justify-content-center">
        <div class="col-sm-3">
            <div class="card text-white bg-dark mb-3" ">
                <div class="card-header text-muted">
                    App name
                </div>
                <div class="card-body">
                    <div id="demo" class="carousel slide" data-ride="carousel">
                        <!---------------------CARD BODY--------------------->
                        <!-- Indicators -->
                        <ul class="carousel-indicators">
                            <li data-target="#demo" data-slide-to="0" class="active"></li>
                            <li data-target="#demo" data-slide-to="1"></li>
                        </ul>


                        <!-- The slideshow -->
                        <div class="carousel-inner" >

                                <div class="carousel-item active">
                                        <img class="card-img-top" src="sample.jpg"
                                             alt="Card image cap"
                                             id="sample">
                                        <h5 class="card-title">Title</h5>
                                        <h6 class="card-subtitle mb-2 text-muted">Card subtitle</h6>
                                        <p class="card-text">Hi quick example text to build on the card title and make up
                                            the bulk of the card's content.</p>
    
                                    </div>
    
                                    <div class="carousel-item">
                                        <h5 class="card-title">Card title</h5>
                                        <h6 class="card-subtitle mb-2 text-muted">Card subtitle</h6>
                                        <p class="card-text">Some quick example text trewrwrwerwerwero build on the card
                                            title and make up
                                            the bulk of the card's content.</p>
    
                                    </div>
                        <!---------------------CARD BODY END--------------------->

                    </div>
                </div>
                <div class="card-footer btn btn-primary">
                    Show me!
                </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

retrieve a changing identifier from a nested iframe within another iframe

There's a challenging task at hand - creating a pack of resources (website pages) through the use of iframes to display page content. The tricky part arises when dealing with multiple iframes within one iframe. The objective is to pass specific style ...

Tips for utilizing Sass and CSS Modules within create-react-app

I've been using FileName.module.scss to style my react elements like this: // Component styling with SCSS import React from "react"; import Aux from '../../hoc/Aux'; import classes from './Layout.module.scss'; const lay ...

How to customize the font size in three.js CSS3DRenderer

I am trying to use threejs's CSS3DRenderer to display text in my 3D view. However, I am facing issues with controlling the font size. Despite setting font-size: 1px in CSS, the text remains large. I also attempted to adjust the scale of the css3dobjec ...

Issue identified: Multer is unable to read the path property of req.file as it is undefined

I recently started working with node.js and wanted to create a simple REST Api with the ability to upload files. I decided to use multer from npm for file uploading and POSTMAN to send post requests. However, I encountered an error when trying to upload a ...

Switch out external CSS stylesheets automatically using toggle scripting

Hello there! I've been trying to figure out a way for this script to switch back to the original CSS external stylesheet. Here is the code that I currently have: $(document).ready(function() { $("#css-master2").click(function() { $("link[title=chang ...

Interact with various div elements bearing the same class name through mouse movements

I am trying to implement a mousemove effect on multiple divs with the same class name but facing an issue where the mouse position doesn't restart inside each div. If you want to see a demo of what I'm describing, click here. Below is the code ...

Does Parsley.js offer a way to configure so that the parsley-success field is not added to an input if it should be completely ignored?

Currently, I am excluding one input and adding the success class (which is fine with me) $('form').parsley({ excluded: '[data-parsley-sum-total="all"]' }); However, there are several other inputs without any validations that I do not wa ...

"Duration parameter in jQuery animate() function not working as expected in Firefox

Just starting out with jQuery and I have a class for absolute centering (it's working as intended): .Absolute-Center { margin: auto; position: absolute; top: 0; left: 0; bottom: 0; right: 0; } #logo { background: url(logo.png) no-rep ...

Having trouble exporting a static HTML file using Next.js

https://i.stack.imgur.com/xQj7q.pngI'm a beginner in the world of React. Recently, I completed a project where I utilized "next build && next export" in my package.json file for static HTML export. By running the npm run build command, an out folder w ...

Menu remains open and unresponsive in Bootstrap

This is an HTML site built using Bootstrap. The site has a menu that should automatically open on mouseover, but currently, it does not close automatically. (function($){ $(document).ready(function(){ $('ul.nav [data-toggle=dropd ...

The CSS background design is experiencing issues in IE9

Check out this code snippet I have for customizing the background of a webpage: body { font-family: "HelveticaNeue", Helvetica, Arial, sans-serif; font-size: 12px; background: -webkit-radial-gradient(50% 20%, circle farthest-side, transparent ...

The removal of the Lodash library from node modules is not occurring

In an effort to reduce bundle size, I made the decision to replace all lodash methods with core js methods in my Vuejs project. Despite attempting various npm uninstall commands such as: npm uninstall lodash npm uninstall lodash --save npm uninstall lodas ...

Session storage conditional statement is not behaving as anticipated in JavaScript

I am currently working on session storage functionality where a user must select one radio button on the first page and then click the next button. On the second page, a div is supposed to show up. On the first page, I have created a function with a set of ...

React Native displaying identical path

Is there a way to dynamically change routes in React Native when a button is pressed? Inside my SplashContainer component, I have the following method: handleToSignUp = () => { console.log("Running handleToSignUp") this.props.navigator.push({ ...

Using Javascript to retrieve information from an API and display the results

Currently, I am working on developing a Chrome plugin that involves querying the Alexa API with the current URL of the browser to determine if it falls within the top 100,000 sites. While I initially had a Python solution in place for this task, my focus n ...

Exploring Vue.prototype attributes and utilizing them

I'm facing a challenge while attempting to globally set a property using Vue.prototype. This is what I currently have: microsoftTeams.initialize(); microsoftTeams.getContext((context) => { Vue.prototype.$teamsContext = true; }); new Vue({ ...

Loading identical items using jQuery Ajax

I have a situation where an ajax request is returning multiple URLs which I am using to create images like: <img URL="1" /> <img URL="1" /> <img URL="2" /> <img URL="1" /> <img URL="3" /> <img URL="2" /> and so on... ...

Beginner tips for adding padding in CSS

Could anyone clarify a discrepancy in the material provided here: w3schools.com code example According to the code : th,td { padding:5px; } Also, based on their explanation here: http://www.w3schools.com/cssref/pr_padding.asp The explanation states tha ...

Applying CSS styles to a page depending on certain conditions

Currently, I have a page in SharePoint that can function as a pop-up. I am using JavaScript to identify whether it is a pop-up by checking if window.location.search.match("[?&]IsDlg=1"). However, I am struggling to figure out how to insert CSS based on ...

The AutoFill extension on Chrome is failing to update the values of the ng-model

I created a custom chrome extension using jQuery to automatically fill in values on my Angular app. However, the modal values are not being updated. How can I update the modal values? In my content.js file, I have the following code snippet: $(document). ...