Why is my Bootstrap table failing to be responsive?

I'm currently using Bootstrap 4 to incorporate a table into my website and encountering difficulties in making it responsive on mobile phones. Unfortunately, when viewing the table on a phone, it appears very zoomed out and not user-friendly. Can anyone suggest how I can modify this table to ensure that it is fully responsive and readable on smaller screens?

Below is the code for my table:

<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" rel="stylesheet"/>
<div class="container-fluid">
  <div class="row">
    <div class="col"></div>

    <main role="main" class="col-md-9 ml-sm-auto col-lg-11 px-4">
      <div class="d-flex justify-content-between flex-wrap flex-md-nowrap align-items-center pt-3 pb-2 mb-3 border-bottom">
        <h1 class="h2">Setup Table</h1>
      </div>

      <div class="table-responsive table-hover">
        <table class="table table-striped" id="setup-table">
          <thead>
            <tr>
              <th scope="col">Column1</th>
              <th scope="col">Column2</th>
              <th scope="col">Column3</th>
              <th scope="col">Column4</th>
              <th scope="col">Column5</th>
            </tr>
          </thead>
          <tbody>
            <div class="row text-center" style="display:flex; flex-wrap:wrap;">
              <tr>
                <th scope="row">some value</th>
                <td>some value</td>
                <td>some value</td>
                <td>some value</td>
                <td>some value</td>
              </tr>
            </div>
          </tbody>
        </table>
      </div>
    </main>
    <div class="col"></div>
  </div>
</div>

Could the issue be due to the table being within a container?

EDIT:

This is what the table looks like in mobile view: https://i.sstatic.net/KSxz2.png

Answer №1

it is important to include a responsive meta tag in the header

<meta name="viewport" content= "width=device-width, initial-scale=1.0"> 

Answer №2

The current table design is already adaptable to different screen sizes. However, if you prefer a more user-friendly layout, consider incorporating a horizontal scrollbar for easier navigation.

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

Adjusting the height of a parent div according to the height of its children

Despite finding similar questions answered here, I am still struggling to make this work. I have two parent divs - one acts as a frame with a border and padding, the other has a solid black background, and the third is where a transparent image will be pl ...

What is the process to include a CSS file in PHP?

Can anyone guide me on how to include my CSS file in PHP? require('config.php'); $cssFile = "style.css"; echo "<link rel='stylesheet' href='/books/style.css'>"; What is the process of adding CSS to a PHP appl ...

I am looking to integrate a WordPress blog post into my Bootstrap website

Is there a way to showcase the 3 most recent posts from my WordPress blog (www.xyz.wordpress.com) on my Bootstrap HTML website without using PHP? Feedburner got me close, but I'm limited in CSS styles and don't want the "Headline by Feedburner" ...

Open the overflow div within a table data cell

My goal is to create a drag-and-drop schedule tool similar to Fullcalendar. I have decided to use a table layout with a rectangular div inside each TD cell to represent tasks. <table onDragEnd={dragend}> <tr> <th>0</th> ...

Displaying text on top of an image with the help of jquery and

I found a tutorial on this website that I'm trying to follow. It involves creating a fading/darkening effect on image rollover with text appearing, but I can't seem to get it to work even when starting from scratch. Despite having experience wit ...

Creating side panels on the left and right using CSS and HTML

I am looking to design a website where users can open sidepanes from both the left and right sides. I am not proficient in JavaScript and would prefer a solution using only CSS and HTML. While browsing, I came across a website that achieves what I want thr ...

Add a custom filter to the active route for a stylish look

I am trying to dynamically change the color of elements in my navbar by creating a filter in my typescript code. I have a string with values like 'greyscale(73%) saturate(1400%)'. How can I apply this string to the fa-icon's filter property ...

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 ...

sliding effect of the background image

Currently, I am in the process of creating a navigation system that includes a background image slide effect. My goal is to mimic the design of a specific website: http://tympanus.net/Tutorials/BeautifulBackgroundImageNavigation/ However, my challenge lie ...

Achieving Text Centering in kableExtra Cells with CSS: A Step-by-Step Guide

Recently, I received a helpful solution that involved using the extra_css = argument in cell_spec() from the kableExtra package. This allowed me to fill the entire cell of my table instead of just the text inside it. However, even after specifying align = ...

Bootstrap 4 tabs function perfectly in pairs, but encounter issues when there are three of them

Having trouble with bootstrap4 tabs not working properly? They function well with 2 tabs using the code below: <div class="row"> <div class="col-12"> <ul class="nav nav-tabs" id="registration-picker-acc-select" role="tablist"> ...

Having trouble setting the default value of a select element with 'selected' in Angular's bootstrap?

Click here I've been facing some difficulties in making the 'selected' tag work to pre-select my default select value. It seems like it might be related to the unique pipe I'm using and how Angular handles it. I have experimented with ...

Is there a way to change the color of a specific tab without affecting the content within it

I am attempting to change the color of an individual tab using jQuery. However, when I set the background attribute in CSS, it colors the entire background instead. What specific property should I be setting to only change the color of the tab itself? ...

What is the best way to pass a CSS root constant to a separate CSS file?

In my Angular test project, I'm experimenting with using the same colors repeatedly. To achieve this, I created a constants.css file where I defined all my root constants, which currently consist of colors. However, I've hit a roadblock when atte ...

What is the method for centering an input field with inline CSS?

Is there a way to center align an input text box on a webpage using only inline CSS? I have tried various techniques, including the following code snippet, but nothing seems to work: <input type="text" id="myInput" style= "margi ...

Is it possible to create a single code that can be used for various buttons that perform the same function?

Whenever I click the right button, the left button appears and when I reach the last page, the right button disappears. However, this behavior is affecting both sections. Is there a way to write separate code for each section? I managed to make it work by ...

Java displays misaligned text vertically

In my attempt to implement word-wrap for my JLabel's text, I referred to this question. The code snippet I used for this purpose is as follows: label.setText("<html style=\"vertical-align:middle;\">"+label.getText()+"</html>"); ...

Inject a directive attribute dynamically into an element using another directive, and ensure the initial directive is set to 'active.'

Let me explain in more detail. I am utilizing the tooltip directive from the UI Bootstrap suite, which allows me to attach a tooltip to an input element like this: <input type="text" ng-model="inputModel" class="form-control" placeholder=" ...

Do we always need to incorporate components in Vue.js, even if there are no plans for reuse?

I've been pondering this question for some time now: is it necessary for every component to be reusable? Consider a scenario where we have HTML, CSS, and JavaScript that cannot be reused. For instance, a CRUD table designed specifically for managing u ...

Tips for maintaining horizontal alignment of menu links

I am frustrated with the vertical alignment of my menus (home, photos, paintings) on my website. I want them to be displayed horizontally instead. Can someone please assist me with this issue? <style> body{background:black} li a{ white-space: ...