The tbody element fails to occupy the full width of the table, leaving the content exposed

HTML:

<body class="header">
    <div class="container-fluid">
        <div class="container d-flex justify-content-center">
            <p class="display-3">Secure Vault</p>
        </div>
    </div>
    <div class="">
        <div class="d-flex justify-content-center align-items-center" style="height: 800px;">
            <div class="container border t-box col-5">
                <table class="table table-hover t-responsive" >
                    <tbody>
                        <tr>
                            <td>
                                Lorem ipsum dolor sit amet cons
                            </td>
                            <td class="d-flex justify-content-center">
                                <button type="button" class="btn btn-outline-light btn-sm">View Details</button>
                            </td>
                        </tr>   

                    </tbody>
                </table>
                
            </div>

        </div>


    </div>

CSS:

.t-transparent{
    background-color: transparent;
}

.half-opaque{
    opacity: 50%;
}

.nav-t{
    height: 70px;
}

.t-box{
    border-radius: 10px;
    padding: 10px;
}

.t-responsive{
    display: block;
    max-height: 300px;
    overflow-y: scroll;
}

tr{
    max-width: 778px;
}

I am working with Bootstrap 5 and facing an issue with the table lines appearing under each row due to the tbody wrapping. How can I resolve this design challenge?

Answer №1

Do you really need to apply the disaply:block style to the <table> element?

.t-responsive{
    display: block; // consider removing this
    max-height: 300px;
    overflow-y: scroll;
}

This is causing the table to stretch across the full width of the viewport. If you prefer the <table> to inherit the width of its parent container, then use width:100%, etc.

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

Does anyone else have a peculiar problem with css width?

Either I have been designing web pages for an extensive period of time without taking a break or something truly bizarre occurred. <div style="background-color:#0F0; margin:5px; height:5px;"></div> This will generate a lengthy bar with a 5-pi ...

Scrolling through four limited list items automatically

Hey there! I am currently working on a design project. You can check it out here. I'm trying to replicate a section from another site, which you can see here. <div class="latest-winners-container"> <h3 class="header">Latest Winners< ...

Migrating WordPress Gutenberg to a Separate React Component: Troubleshooting Missing CSS Styles

I am in the process of developing a standalone version of the Gutenberg block editor from Wordpress that can function independently outside of the Wordpress environment. My goal is to integrate the Gutenberg editor as a React component within an existing R ...

Utilizing the "::first-letter" pseudo element selector in conjunction with the MuiButton class in Material UI - What is the process?

Is it possible to change the text case of Button text inside Material UI Button to sentence case with CSS? https://mui.com/components/buttons/ The text inside the button - ADD FRIEND should be transformed to sentence case as Add friend. I attempted to o ...

How can I ensure that Div and its contents are only responsive to changes in width?

Initially, I'm feeling a bit confused but I'll try my best to articulate my issue and what I need. Within a div element, there's another div that I want to move left and right only, following the same path as an image when resizing (refer t ...

Using Jquery to loop through various select options within a designated container div

I am seeking a way to loop through multiple select options within a specific div using the jQuery each function. If any field is left empty during this iteration, I would like the loop to break and set the reqCourseFlag variable to 0. The current implement ...

When the browser width decreases, the layout's rows become wider

Here is the code snippet I'm using: <style> a.item { border:1px solid #aaa; background:#ddd; padding:10px; ...

React Image Slider not loading pictures

Can someone help me troubleshoot why my images are not displaying in the slider on my homepage? I have set up the slider using React Slideshow Image, but the images are not showing up for some reason. I am also wondering if anyone knows of any full-screen ...

In Firefox, there is a peculiar issue where one of the text boxes in an HTML form does not display

In my HTML form, users can input their first name, last name, and phone number to create an account ID. The textboxes for first name, last name, and account ID work smoothly on all browsers except Firefox. Surprisingly, the phone number textbox doesn' ...

Incorporating information collected from a modal form into a table using vue.js

insert code hereThis single page application allows users to input data into a modal, which is then automatically added to a table on the main page. var modal = document.getElementById('modalAdd'); var modalBtn = document.getElementById(' ...

Can anyone provide guidance on how to trigger 3 unique functions in a specific order using JavaScript?

I've been troubleshooting this issue for quite some time, but I just can't seem to figure it out. Here's my dilemma: I have three functions - one to shrink a div, one to reload the div with new data, and one to enlarge the div - all triggere ...

Excessive size of bootstrap form

I'm currently working on designing a form within a section that has a width of col-sm-8. The form consists of three columns: label, text input, and username check. I've designated the label to have a width of col-sm-2, the username check to have ...

Is it possible to generate this result using only Bootstrap 5.2.3?

I'm currently working on a simple HTML project that aims to replicate the layout shown in the image below. I want the output to look exactly like what's displayed in the provided image. The task does not require CSS, only Bootstrap is needed for ...

If using conditional SCSS, consider overriding the variables

When working with React state, I am passing a list and calling the component where needed. comments: { elementLabel: "Comments", elementType: 'textarea', className: "form-control", ...

Creating dynamic web content using PHP and JavaScript

I stumbled upon a tutorial on the PHP.net website within the "PHP and HTML" manual which includes an example titled Generating JavaScript with PHP. Currently, I am experimenting with a basic demo of this concept on my own to grasp the process before attem ...

Creating an engaging user experience with a Django form

Creating a dynamic calculator <div id="calculator"> <h2>Calculate the price of sawing materials</h2> <form method="post" action="{% url 'products' %}"> {% csrf_token %} & ...

Update the gulp watch function to use gulp@4

We are currently in the process of transitioning from <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="fb9c8e978bbbc8d5c2d5ca">[email protected]</a> to gulp@4, and encountering difficulties during the switch. Upon r ...

Tips on enhancing the appearance of your numberbox with vibrant colors

Hello everyone! I am working with some devextreme code blocks and need help in changing the border color of a numberbox to red. Can anyone guide me on how to achieve this? import React, { useState } from 'react'; import { NumberBox } from 'd ...

Eliminate whitespace on the right side of a webpage using Bootstrap

I am currently working on a form that will appear in a modal, but I need it to be centrally aligned so that I can reduce the size of the modal. Here is what I have implemented so far: It seems like there is some space being "reserved" for columns that are ...

Passing data from one NodeJS page to another

I am working on creating a User management system in Node. My goal is to have a page that displays all users in a table format. When the edit button is clicked, I want to navigate to another page with detailed information about the selected user. However, ...