Overflow issue with Bootstrap 4 cards on small screens

When working on my application, I find myself using the bootcard .card class quite frequently.

However, I've noticed that when switching to mobile view, there is a significant overflow issue that causes a display bug and shifts my entire page out of place.

This means that every time I want things to look right in mobile view, I have to make adjustments to the code within my .card class. It's quite frustrating.

On large screens:

https://i.sstatic.net/uLqPV.png

On small screens:

https://i.sstatic.net/VEkFD.png

Here is the code snippet causing the issues :

<div class="card mt-4">
    <h5 class="card-header">
        Subscription
        <div class="float-right">
            <button class="btn btn-light btn-sm mb-1">Do not cancel subscription</button>
        </div>
    </h5>
    <div class="card-body">
        <table class="table table-borderless">
            <thead>
                <tr>
                    <th>PRODUCT</th>
                    <th>NEXT INVOICE</th>
                    <th>CREATED ON</th>
                </tr>
            </thead>
            <tbody>
                <tr>
                    <td>
                        TETETE
                        <span class="badge badge-secondary">Cancellation scheduled for 05/03/2020</span>
                        <br>
                        <p class="text-secondary">
                            basic
                        </p>
                    </td>
                    <td>
                        No upcoming invoice
                    </td>
                    <td>
                        04/03/2020
                    </td>
                </tr>
            </tbody>
        </table>
    </div>
</div>

Your assistance with this matter would be greatly appreciated!

Answer №1

Is it feasible to switch out the table for columns instead?

<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" rel="stylesheet"/>
<div class="container-fluid">
  <div class="card mt-4">
    <h5 class="card-header">
      Subscription
      <button class="btn btn-light btn-sm mb-1 float-sm-right">Do not cancel subscription</button>
    </h5>
    <div class="card-body">
      <div class="row">
        <div class="col-12 col-sm-4">
          <h5>PRODUCT</h5>
          ITEM
          <span class="badge badge-secondary">Cancellation scheduled for 03/05/2020</span>
          <p class="text-secondary">
            basic
          </p>
        </div>
        <div class="col-12 col-sm-4">
          <h5>NEXT BILLING</h5>
          <p class="text-secondary">
            No upcoming bill
          </p>
        </div>
        <div class="col-12 col-sm-4">
          <h5>CREATED ON</h5>
          <p class="text-secondary">
            03/04/2020
          </p>
        </div>
      </div>
    </div>
  </div>
</div>

Answer №2

Ensure the table has the class table-responsive:

body{ width: 360px; } /* Galaxy S */
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" rel="stylesheet"/>
<div class="card mt-4">
    <h5 class="card-header">
        Subscription
        <div class="float-right">
            <button class="btn btn-light btn-sm mb-1">Do not cancel subscription</button>
        </div>
    </h5>
    <div class="card-body">
        <table class="table table-borderless table-responsive">
            <thead>
                <tr>
                    <th>PRODUCT</th>
                    <th>NEXT INVOICE</th>
                    <th>CREATED ON</th>
                </tr>
            </thead>
            <tbody>
                <tr>
                    <td>
                        TETETE
                        <span class="badge badge-secondary">Cancellation scheduled for 03/05/2020</span>
                        <br>
                        <p class="text-secondary">
                            basic
                        </p>
                    </td>
                    <td>
                        No upcoming invoice
                    </td>
                    <td>
                        03/04/2020
                    </td>
                </tr>
            </tbody>
        </table>
    </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

Exploring the power of utilizing the Graphics class and the DrawRectangle method with negative x and y coordinates within web applications using C#

Problem: I am facing a challenge with replicating the configuration of a solar power plant field on a webpage using a set of rectangles for mirrors and receivers. My task is to dynamically add rectangles to webpages with specified X, Y, width, and height p ...

"Maximize user experience: Eliminate the "#" in your URL by utilizing anchor tags for one-page navigation in

I've created a website with menu tabs including Home, About, Work, and Contact. To make navigation easier, I've used anchor tags for this one-page layout. However, I'm concerned about the URLs updating when clicking on the tabs. I prefer to ...

Is it possible to move my Home button to the upper left corner of the header using CSS?

`<header> <img src="images/chefs-hat.png"> <p>Popular Recipes</p> <button class="home"> <a href="index.html">Home</a> </button> </header> .home { width: 100px; text-decorati ...

A centered layout design with a background that extends beyond the element

I am facing a challenging problem with a relatively simple layout. To summarize My layout is centered The sidebar background should extend all the way to the left The section background should extend all the way to the right The backgrounds are purely v ...

Error in hover feature not performing to expectations

Check out my jsfiddle link: http://jsfiddle.net/ganganp/x62wR/5/ $('#rotator0 div').hover( function () { ssrc = $(this).find('img').attr("src"); valt = $(this).find('img').attr("alt"); ...

Using Jquery to select the parent element and then adding a CSS selector to it

I am currently exploring the most effective approach to accomplish this task. My goal is to expand/collapse all hidden divs on a given page. While this is usually not an issue, I have four distinct sections that necessitate independent expand/collapse func ...

Reorganize elements using CSS styling

I have a trio of child divs with the classes span2, span7, and span3. When my browser width drops below 763px, I want them to display in the order span2, span3, and span7. How can I achieve this using CSS? Here is the code snippet I started with: <div ...

I'm having trouble accessing the Github website. Is there anyone who can lend a hand?

I am facing difficulties accessing the Github webpage through my home Comcast network. It seems that the issue I am experiencing is similar to the one mentioned in this Stack Overflow post about Could Not Resolve Host github.com. However, since the DNS se ...

Retrieving an image from an input file and setting it as the background of a div element

I am currently developing a whack the mole game using Vanilla JS, and I'm attempting to allow players to choose their own target by uploading an image file. However, despite days of searching for a solution, I have not been successful. HTML: <inpu ...

Arranging XML information in PHP from most recent to oldest

I have a working code that I want to modify so that the Observed Data is displayed from the newest date to the oldest. How can I flip only the Observed Data? Here is my current code: <?php $url = "http://r7j8v4x4.map2.ssl.hwcdn.net/NOD_R.xml"; $xml = ...

Incorporating a navigation bar at the top and a sidebar on the left side of the lower half of an HTML webpage

Currently utilizing materializecss and bootstrap, I am aiming to create a design that resembles: --------------------------------- --------------------------------- | | | | The objective is to split the page into two horizontal sections. The ...

Creating a circular shape that adjusts to different screen sizes using only CSS

Is there a way to create perfect circles using only CSS without them turning into ovals when using percentage values for height? ...

Can a JavaScript framework be created to ensure all browsers adhere to standards?

As someone who isn't an expert in JavaScript, I wonder if it's feasible to create a comprehensive embeddable JavaScript file that ensures all browsers adhere to standards. Could there be a compilation of known JavaScript hacks that compel each br ...

What is the best way to extract information from a dynamically generated input field using vanilla JavaScript?

Creating a dynamic input field inside the 'education-field' div is the main goal here. The user can add more fields by clicking the "Add more" button, and the data from these input fields is crucial for form validation purposes. Users can input t ...

A mesmerizing Fullscreen CSS Slideshow that creates a stunning double fade in/out effect for overlaid elements on background slide elements

Looking to create a unique slide show using background images and text with specific animations? Check out this jsfiddle. This slideshow features cover background images, displaced text, and button-controlled transitions without auto loop animation. Each ...

a label placed in a random location on the webpage

I am experiencing an issue on our website that uses a WordPress theme called Flat. Whenever we add a new page, there is an 'a' tag that appears to surround the entire page. This tag is not visible in the editor, leading me to believe it is being ...

The dropdown menu items spill out beyond the confines of the container

I'm currently facing some challenges and struggling to find a solution. Unfortunately, I haven't been able to find any guidance on this issue. Important: To view the output, click on "Run snippet" and make it full screen by clicking on the hamb ...

Issues with ASP.net rendering stylesheets

Here is the layout of my Index.cshtml page: <html> <head runat="server"> <link href="~/Content/index.css" rel="stylesheet" type="text/css" /> <asp:ContentPlaceHolder ID="HeadContent" runat="server" /> </head> < ...

What is the best way to update the color of an fa icon when an error message is displayed using PHP

I am facing an issue with my form where error messages are displayed on certain input fields. The error messages show up correctly, but I want to change the color of the "fa" icon in the field when its corresponding error message appears. My goal is to ma ...

Ways to transfer a variable from a Node.js script to a JavaScript file on the client side

Seeking guidance on how to transfer the "myBlogs" variable from my Node.js file ("server.js") to a frontend JavaScript file ("blogs.js"). I intend to utilize this variable in the JS file to iterate through the array it contains, generating a template for e ...