Prevent the bootstrap header in a table from scrolling by enclosing it in

I am encountering an issue with fixing the headers of multiple tables in a page within their dedicated divs. Despite trying various methods, I haven't been successful as the fixed header overflows the div. I want to confine it within the div.

Additionally, the code sample includes 2 tbody tags and 1 tfoot tag that require specific solutions.

Here is the example code:

<div class="col-sm-12 col-lg-12">
        <h2 class="card-title">PRODUCT VALUE</h2>


                <table class="table table-bordered table-hover table-responsive table-striped">

                    <thead>
                        <tr>
                            <th style="width:115px">CONDITION</th>
                            <th>PRODUCT NAME</th>
                            <th>COMMODITY CODE</th>
                            <th>WEIGHT</th>
                            <th>COST</th>
                            <th>QUANTITY</th>
                            <th>CLAIM AMOUNT</th>
                            <th>TYPE</th>
                            <th style="width:100px">&nbsp;</th>
                        </tr>
                    </thead>


                    <tbody>

                        <!-- BIND PRODUCT VALUES -->
                        <tr ng-repeat="item in productValue.Values" ng-if="!item.IsDelete">

                            <!--NEW/USES-->
...
                                </button>
                            </td>
                        </tr>

                    </tbody>


                    <tbody>
...
                                </button>
                            </td>
                        </tr>

                    </tbody>

                    <tfoot>
                        <tr>
                            <td colspan="6">&nbsp;</td>
                            <td><strong>Total</strong></td>
                            <td>
                                <strong>{{productValue.total | currency}}</strong>

                            </td>
                            <td>&nbsp;</td>
                        </tr>
                    </tfoot>
                </table>
</div>

Answer №1

Implemented a new class called "clear" in the TR tag, and the following CSS code has resolved the issue for me.

.table-scrollable thead {
    width: 100%;
}

.table-scrollable tfoot {
    overflow-y: auto;
    width: 100%;
}

.table-scrollable tbody {
    max-height: 250px;
    overflow-y: auto;
    width: 100%;
}

.table-scrollable thead, .table-scrollable tbody, .table-scrollable tfoot, .table-scrollable tr, .table-scrollable td, .table-scrollable th {
    display: block;
}

.table-scrollable tbody td, .table-scrollable tfoot td, .table-scrollable thead > tr > th {
    float: left;
}

.clear {
    clear: both;
}

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

"Utilizing Kendo's server-side paging feature to efficiently handle large datasets and

I am facing an issue with my Kendo Datasource and the resulting JSON data. The JSON has a column called "TotalRecords" and I need to set this total to the Kendo Datasource so that my server paging can work correctly. Below is the code snippet that I am cur ...

Using jQuery to call a function within another function

Here is some code that I am working with: function open_viewer() { $('.image_thumb').click(function(){ var reqz = 'id='+$(this).attr('id')+'&i='+$(this).attr('i'); $.ajax({ type: ' ...

Explore the interactive feature of hovering over a component within a div that is enhanced with a transformative translate3d effect upon hover. Discover the seamless event queuing

Within a div, there is a modal component that includes a transform: translate3d effect with hover transition. The div is created using vue.js list rendering method. Upon opening the modal and hovering over it, it jerks between the parent div and its intend ...

jQuery allows you to assign the identical function to multiple actions

I am faced with a situation where I have multiple actions that need to perform the same function. <ul> <li> <select id="s1"> <option>Name</option> <option>Year</option> ...

Pass a variable value as a parameter to a jQuery function using code-behind

Within my code behind, I am retrieving the [IDphoto] from an SQL database. My goal now is to pass this IDphoto as a parameter to a jQuery function upon onClick. How can I achieve this? Code behind sb.AppendFormat("<a onclick='popup()' href=& ...

Issue with CKEditor within a ColorBox dialog box

Could someone please assist me? I am facing an issue with my HTML page where I have incorporated a ColorBox modal popup. Inside the ColorBox popup, there is a CKEditor. The problem is as described below: In Internet Explorer, the CKEditor functions proper ...

What is the best way to divide widgets in a Wordpress Sidebar?

I am looking to customize the spacing between widgets in my Wordpress sidebar, similar to what is shown on this example site. Currently, my sidebar does not have the desired spacing. I have tried various CSS codes found online, but none of them seem to be ...

Adjust the height of a div using jQuery once the AJAX call retrieves the data

There is a div that always matches the height of the adjacent div, depending on the content loaded in it. This setup was functioning properly until I implemented a search feature using jQuery. Now, when I perform a search, the element used in the jQuery ca ...

Why does using rgba color with an alpha value cause my div to become see-through?

I am currently attempting to assign a background color to a specific style of pop-up, but whenever I use a value that includes an alpha channel, it ends up being transparent. This is the CSS code I have been using: --color: 255, 144, 106, 0.18; background ...

Is there a way to completely remove all styling from a specific child element?

Struggling with a drop-down menu issue - the parent element has a border, but I don't want that style to be inherited by the child sub-menu. Despite my attempts to remove the border using border: 0px, it's not working as expected. Is there any wa ...

The jQuery UI Tabs Ajax feature seems to only be displaying content in the first tab that is

My jQuery UI tabs are set up to load their content using the ajax method: <div id="tabs"> <ul> <li><a href="/messages/inbox" title="Inbox"><span>Inbox</span></a></li> <li><a href ...

Utilizing jQuery to toggle nested divs within identical parent divs when they contain more than three elements using the :nth-child selector

Within my HTML markup, I have created two parent div elements that are exactly the same but contain different content. My goal is to have a functionality where if a parent div has more than 3 child div elements, a "show more" text will be displayed at the ...

Error: Syntax error was not captured due to lack of closing parenthesis at the end

I keep encountering a syntax error: Uncaught Syntax Error: missing ) after argument list The data in the table is displaying correctly. However, the error pops up when I click on the Delete button within the table. Despite reviewing the code mul ...

Tips for arranging letters on separate lines using CSS

I have a set of four divs that display numbers, and I want to show the corresponding words below each number. Despite trying to use the p tag with white-space: pre; in CSS, I have not been successful: #c { padding-top: 30px; padding-bottom: 30px; } ...

Instead of modifying the selected class, jQuery generates inline styles

Utilizing the following code to dynamically create a class: $("head").append('<style type="text/css"></style>'); var newStyleElement = $("head").children(':last'); newStyleElement.html('.move{transform: translateX(1 ...

use jquery to automatically invoke a function with the .animate method

I've hit a snag in my jQuery project and could use some help. I'm currently utilizing jQuery's .animate() function like so: $(".planeid").animate({top:'590px'},1000); with an initial top value of 0. Is there a way to initiate a ...

Unable to post form data into database due to Javascript undefined data situation

I've been working on an HTML form that can interact with a PHP API to retrieve client data and then update user stats in a MySQL database. Currently, I am converting the data into a JSON object and using JSON.stringify to create a string for sending ...

Issue with $.ajax request even when valid JSON data is provided

Below is the code I am currently using: var jsonURL = "http://www.sodexo.fi/ruokalistat/output/daily_json/440/2013/10/25/fi"; var request = $.ajax({ url: jsonURL, dataType: "json", type: "GET" }); request.done(functio ...

What is the best way to showcase a table below a form containing multiple inputs using JavaScript?

Context: The form I have contains various input fields. Upon pressing the [verify] button, only the "first name" is displayed. My goal is to display all input fields, whether empty or filled, in a table format similar to that of the form. Exploration: ...

What could be causing my React components to not display my CSS styling properly?

If you're developing a React application and integrating CSS for components, ensure that you have included the style-loader and css-loader in your webpack configuration as shown below: module.exports = { mode: 'development', entry: &apo ...