Scrollable Bootstrap cshtml table with custom column widths

I am currently working on creating a side-scrolling table using Bootstrap formatting. The challenge I'm facing is displaying the entire string from the dropdown selects (DropdownList) as the column widths are limited due to being encapsulated within bootstrap. Ideally, I would like to make the columns wider and enable side-scrolling specifically for the table.

https://i.sstatic.net/4yPzm.png

<div class="row">
    <div class="col-md-12">
        <table id="DetailsMolarTable" class="table table-striped table-condensed">
            <thead>
                <tr>
                    <th colspan="1">@ApplicationStrings.RequestedConcentration</th>
                    <th colspan="1" class="conc-requested-weight-input"></th>
                    <th colspan="1" class="conc-requested-volume-input"></th>
                    <th colspan="1" class="oem-range-input"></th>
                    <th colspan="1">@ApplicationStrings.ConcCertified</th>
                </tr>
                <tr>
                    <th hidden>ID</th>
                    <th class="col-md-1 conc-requested-molar-input">@ApplicationStrings.Molar</th>
                    <th class="col-md-1 conc-requested-weight-input">@ApplicationStrings.Weight</th>
                    <th class="col-md-1 conc-requested-volume-input">@ApplicationStrings.Volume</th>
                    <th class="col-md-1 oem-range-input">@ApplicationStrings.OEMRange</th>
                    <th class="col-md-1 conc-certified-molar-input">@ApplicationStrings.Molar</th>
                    <th class="col-md-1 conc-certified-weight-input">@ApplicationStrings.Weight</th>
                    <th class="col-md-1 conc-certified-volume-input">@ApplicationStrings.Volume</th>
                    <th class="col-md-1 precision-select">@ApplicationStrings.Precision</th>
                    <th class="col-md-1" >@ApplicationStrings.Units</th>
                    <th class="col-md-1">@ApplicationStrings.PXNum</th>
                    <th class="col-md-2">@ApplicationStrings.ComponentName</th>
                    <th class="col-md-1">@ApplicationStrings.ComponentGrade</th>
                    <th class="col-md-1">@ApplicationStrings.Uncertainty</th>
                    <th class="col-md-1">@ApplicationStrings.Instruments</th>
                    <th class="col-md-1">@ApplicationStrings.GasStandards</th>
                    <th></th>
                </tr>
            </thead>
            <tbody>
                @foreach (var item in Model.Details)
                {
                <tr>
                    <td id="certDetailId" hidden class="item-index">@item.DetailID</td>
                    <td class="conc-requested-molar-input">
                        <div class="input-group input-group-sm">
                            <input type="text" class="form-control" value="@item.ConcRequested_Mol" />
                            <div class="input-group-btn">
                                <button class="btn btn-default" name="btnBalance" aria-label="balance concentration">
                                <span class="glyphicon glyphicon-equalizer"> </span>
                                </button>
                            </div>
                        </div>
                    </td>
                    // Rest of the table content omitted for brevity
                </tr>
                }
            </tbody>
            <tfoot><tfoot>
        </table>
    </div>
</div>

If you have any other suggestions or alternative solutions, feel free to share them! :)

Answer №1

    <div style="overflow-y:auto; max-height: 100px">
        <table id="table" class="table table-condensed table-hover globalVariablesTable table-striped">

            <tr>
                <th><strong>Variable Names</strong></th>
                <th><strong>Values</strong></th>                                             
                <th><strong>Actions</strong></th>                                            
            </tr>
            <tbody>
                <tr>
                    <td><strong>Variable Names</strong></td>
                    <td><strong>Values</strong></td>                                             
                    <td><strong>Actions</strong></td>                                            
                </tr>
            </tbody>
        </table>
    </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

personalizing variables with SASS in Bootstrap 4 for .NET Core applications

Having experience with .NET MVC, I am now delving into learning about .NET Core and incorporating Bootstrap with SASS. Unfortunately, the setup process has been a challenge for me as I navigate this new territory. I successfully set up my .NET Core projec ...

What is the best way to achieve a sleek and seamless scrolling effect on a webpage?

Is there a way to improve the scrolling effect on my website using jQuery? I find that the default scrolling behavior in most browsers is jumpy and I'm hoping to achieve a more smooth and polished look. ...

`Set the body height to equal that of the entire document`

Currently facing an issue on the test page when scrolling down: The body element is set to have a height of 100%, but it only takes up the viewport's height, not the entire document height. The goal is for the page to always display at 100% of the d ...

The style attribute of the HTML <td> tag does not properly adhere to the specified width setting

When I look at this code snippet, I noticed that the width percentage attribute of the td tag is being ignored in Firefox and IE. As a result, both "Password" and the text box are taking up half of the row, which feels like a waste of space. Can you spot a ...

Steps to create an automatic submission feature using a combobox in HTML5 and then sending the retrieved data back to the HTML file

Here is the code snippet I've been working on: <strong>Station Name</strong> <!--This portion includes a combobox using HTML5 --> <input type=text list=Stations> <datalist id=Stations> <option>Station1</opt ...

What is the best method for navigating to the next div element with Javascript?

Currently designing a website filled with Divs set to 100% height. I am working on creating a button that, when clicked, smoothly scrolls to the next div on the page. Below is the snippet of code I have written to achieve this functionality: $(".next"). ...

Resolving Bootstrap 4 column resizing problem: Ensuring the last columns fill the entire width of the row

Hello! I am facing an issue with maintaining the column layout on different screens and varying numbers. Currently, I am working with: - 3 columns per row on desktop - 4 columns per row on iPad - 2 columns per row on mobile On the desktop, when I have a ...

Can the z-index of multiple CSS elements collaborate harmoniously?

Currently, I am trying to implement a feature where I need to display a notification dropdown on top of a carousel. To achieve this, I am utilizing the z-index property in my code. The challenge is that I have separate CSS files for the notification dropdo ...

Tips for adjusting the progress bar to 100% and back to 0%

My goal is to increase the progress bar percentage with each click. Currently, it only goes up to 75%. When saving, it should show 100%, but it's not displaying that properly. On clicking the back button, it should reset to 0% on the third click. HTM ...

javascript box is hidden to prevent displaying of values

I need the negative character to disappear when the user clicks the minus (-) button. The count should stop at 0. Currently, it is displaying characters like -1, -2, -3. I only want to show 0 or numbers greater than 0. <script type="text/javascript" ...

Checkbox enabled Bootstrap image

I am encountering a minor issue where I am attempting to incorporate a simple image that can be toggled on and off by clicking on it. After coming across some bootstrap code online, I decided to test it in my project. Unfortunately, the code does not seem ...

Having trouble selecting the first td within a tr using CSS3 selectors

I'm encountering an issue with selecting the first td in the tr of a dynamically generated table. I've attempted to do this using: .record_list tbody tr td:first-child { text-align: center; } However, the styles are not being applied as ex ...

Hover effect that smoothly transitions to a background image appearing

I want to achieve a smooth fadeIn effect for the background image of a div. Currently, I have a function that displays the background image when hovering over the relevant div, but the transition is too abrupt. I would like it to fade in and out instead of ...

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

Determine how to use both the "if" and "else if" statements in

/html code/ There are 4 textboxes on this page for entering minimum and maximum budget and area values. The condition set is that the maximum value should be greater than the minimum value for both budget and area. This condition is checked when the form i ...

"I recently started using Protractor and as per company policy, I am unable to utilize XPath. I am facing difficulties with the code below and would greatly appreciate any insights or assistance provided

I am looking for guidance on how to write automation test scripts for a small AngularJs application using the cucumber-protractor-typescript framework. As someone new to Angular applications, I am particularly concerned about creating reliable locators. B ...

Looking for assistance with CSS coding for an XML table

Struggling with styling an XML file into a table using CSS. Despite multiple attempts, I just can't seem to achieve the desired look. Provided below is my XML code. Seeking assistance from anyone who can offer a solution to this perplexing issue. &l ...

What are some methods to maintain consistent height for each list item in an unordered list on small screens like mobile devices?

While vh works well for larger screen sizes such as laptops, it may not maintain the height of the li on smaller devices like mobiles. Is there a better approach than relying on media queries to achieve responsiveness across different screen sizes? ...

How should I refer to this style of font?

After trying to implement a font from bulletproof @font-face as a template for my website, I am facing issues. My goal is to utilize the perspective-sans black regular font. Despite uploading the necessary files - including the css style sheet provided in ...

Creating a CSS binding for width: a step-by-step guide

I have a complex layout with multiple elements in different divs that need to be aligned. Hardcoding the width or using JS on page load to specify values in pixels both seem like messy solutions. How can I achieve this without causing a zigzag effect? Her ...