Issue with Bootstrap table cell not following specified widths

I have implemented a vue app using regular Bootstrap 4 without Vue-Bootstrap. The issue I'm facing is with one of the responsive-tables on my site. Despite trying different methods, including copying a fully functional table, this specific table does not adhere to the specified widths.

HTML

<div class="form-group row">
    <div class="col-12">
        <div class="table-responsive">
            <table class="table table-striped table-hover">
                <thead>
                    <tr>
                        <th scope="col" style="width: 8%">Item</th>
                        <th scope="col" style="width: 3%">Description</th>
                        <th scope="col" style="width: 5%">Brand</th>
                        <th scope="col" class="text-right" style="width: 4%">RRP</th>
                        <th scope="col" class="text-right" style="width: 4%">Price</th>
                        <th scope="col" style="width: 4%">Stock level</th>
                        <th scope="col" style="width: 5%">Weight (KG)</th>
                        <th scope="col" style="width: 6%">EAN</th>
                        <th scope="col" style="width: 5%">MPN</th>
                        <th scope="col" style="width: 31%">Web friendly name</th>
                    </tr>
                </thead>
                <tbody>
                    <tr v-for="product in stock">
                        <td scope="row">{{product.item}}</td>
                        <td class="text-truncate">
                            <span v-tooltip:bottom.html="product.description">{{product.description}}</span>
                        </td>
                        <td>{{product.class}}</td>
                        <td class="text-right">{{product.retail_price | amountFormat}}</td>
                        <td class="text-right">{{product.price_each | amountFormat}}</td>
                        <td>{{product.free_stock}}</td>
                        <td>{{product.weight}}</td>
                        <td class="text-truncate">
                            <span v-tooltip:bottom.html="product.ean">{{product.ean}}</span>{{product.ean}}</td>
                        <td class="text-truncate">
                            <span v-tooltip:bottom.html="product.mpn">{{product.mpn}}</span>{{product.mpn}}
                        </td>
                        <td class="text-truncate">
                            <span v-tooltip:bottom.html="product.web_name">{{product.web_name}}</span>
                        </td>
                    </tr>
                </tbody>
            </table>
        </div>
    </div>
</div>

The table displays with a horizontal scrollbar. It's been noted that despite setting the 'Description' column width to 3%, it doesn't seem correct. https://i.sstatic.net/Kam9Z.png

All other tables are structured similarly, and no additional CSS is being applied to this particular page to cause the discrepancy.

Even when attempting to adjust the first column width to 2% using devtools, the change isn't reflected, leaving me puzzled about the root cause.

Answer №1

From my understanding, bootstrap is designed to automatically handle responsiveness when it comes to tables and similar elements. However, based on the image snippet you provided, I noticed that some columns are missing. Perhaps including all the columns might resolve the issue? Considering that "description" is a fairly long word, adjusting its width directly may not be straightforward. You could try changing the text size first, which could then affect the column width. These are just my thoughts on the matter.

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

Issue with Navigation Bar when reducing screen width

I'm currently working on creating a navbar that includes an image logo, title, navigation links, and social links. To achieve this, I've divided the navbar into 4 separate divs. However, I've noticed that when I decrease the screen width usi ...

Issues with Jquery datatable causing column header to overlap the table header

I am facing an issue with my datatable as the table is not displaying correctly. Could someone advise me on how to troubleshoot and fix this problem? Below is the code snippet in question: $(tbName).dataTable({ "sScrollX": "100%", "sScro ...

When the browser window is 2500px wide, Bootstrap's col-lg class takes precedence over col-xl in a container-fluid layout

Using Bootstrap 4.5 container-fluid with the inability to get col-xl formatting to work properly. The search criteria form looks like this: <div class="row"> <div class="col-sm-12 col-md-3 col-lg-5 col-xl-2"> <div cl ...

Utilizing Bootstrap 4's nesting feature for optimal layout on an iPad in landscape

My nested content is functioning properly on all screen sizes except for ipad-landscape. Wouldn't it make more sense for the class triggered on ipad-landscape to be col-sm instead of col-lg? <div class="row"> <div class="col-lg-3 col-sm- ...

What is the best way to ensure that a block level element with a fixed or absolute position stays within the bounds of the page and automatically adjusts if the edges start to

In my current project, I am working on adding a new feature to the existing page. The challenge is to include an element that will be displayed above or below a button, which will serve as a toggle to open or close it. This element needs to be triggered by ...

Concealing Bootstrap 3 elements on a split-screen layout

I encountered a peculiar issue with Bootstrap 3. When I resize my browser width to half the screen, there is a slight 1px threshold where both "hidden-xs" and "hidden-sm" elements become visible simultaneously. Is there a way to fix this so that only one o ...

Angular2 poses a strange problem with ngClass

It seems like Angular is expecting me to use single quotes for the class names even if there are no hyphens in my CSS class name. I've tried everything but Angular keeps insisting on using hyphens for this specific CSS class... it's strange, or m ...

Issue with Mobile NavBar remaining visible after clicking on target element in HTML CSS

On my website, everything works perfectly with the Nav bar except for when I am on mobile. When I click on any href from my Nav Bar, it directs me to the correct location but does not close the Nav Bar afterward. I need it to function this way: After click ...

Looking for a drag-and-drop solution using Vanilla Javascript, no need for jQuery

Looking for assistance with creating a click-and-drag solution for a background image using Vanilla Javascript. I came across a jQuery solution on Codepen, but I need help translating it into Vanilla Javascript. Draggable.create(".box", { ...

Styling X and Y axis font color in charts using JavaFX 2.x CSS

Is there a way to change the font color of both X and Y axes? In my search through the css reference for fonts, I only found properties like font-size, font-style, and font-weight. font-size, font-style and font-weight I attempted to use -fx-font-color ...

Positioning pop-up windows using Javascript and CSS techniques

In my web application, there is a search field that allows users to enter tags for searching. The window should pop up directly below the search field as shown in this image: Image I am trying to figure out how the window positioning is actually d ...

Utilize React to float the Material UI SwipeableDrawer component to the right side of the screen

I'm currently working on a project that involves using material UI alongside React/Redux. There has been a recent change in the Figma file where the SwipeableDrawer component is now positioned on the right side of the screen instead of the left. I&apo ...

I aim to toggle the visibility of input fields upon clicking a button

Form.html <form [formGroup]="myForm"> <ion-button [(ngModel)]="isActive"(click)="onClick()" >Add</ion-button> <ion-item> <ion-label position="floating">First Name</ion-label&g ...

Expansive picture feature within jQuery Mobile

I need help with displaying a large image (685 × 900, only 25kb in PNG) in the 'content' section so that it adjusts automatically for different screen sizes and allows users to zoom in using their fingers. Currently, I have this code: < ...

What advantages does implementing W-100 on the row class offer in Bootstrap 4?

Currently in my project, the container is fluid and expanding to take up the full width of the screen. However, the row that follows it is only utilizing about 60% of the available space. Images Container: Row: What could be causing this discrepancy, e ...

Show all span elements in a map except for the last one

Within my ReactJS application, I have implemented a mapping function to iterate through an Object. In between each element generated from the mapping process, I am including a span containing a simple care symbol. The following code snippet demonstrates t ...

Show a pop-up when hovering over each row of a Material UI table and address the problem with the box

Working on a react app using React v18.2 and Material UI V5, I successfully created a table with MUI Table component where I want to display a popover for each row when hovered over. To achieve this, I added a simple popover component to the last cell of ...

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

Steps to establish the starting value as 'Concealed'

I stumbled upon this interesting example that demonstrates how to create expandable/collapsible text when clicked. My question is, how can I initially set the value to be hidden so that the paragraph starts off collapsed and expands only when clicked? He ...

assisting with the transition effect using CSS3, JS, or jQuery

I am looking to alter the background-image of this particular image when transitioning to another one from my images folder, similar to this example. Below is the code that I have: CSS .image { position: relative; overflow: hidden; -webkit-tr ...