The table headers stand boldly against the backdrop of the modal message

For a while now, I've been struggling with a problem that I just can't seem to figure out. Here is a screenshot of the issue.

Screenshot

The main issue I'm facing is getting the background around the green content to appear dark while keeping the table headers visible above the dark background. Can anyone help me solve this? Below are the CSS styles:

.modalMenu {
    display: block;
    position: fixed;
    z-index: 15;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgb(0,0,0);
    background-color: rgba(0,0,0,0.4);
}
.modal-success-message-content {
    background-color: rgba(0, 230, 0, 0.9);
    margin: 15% auto;
    padding: 10px;
    border-radius: 5px;
    width: 70%;
    height: auto;
}

Below are the CSS styles for the framework being used for the table:

.sticky-table {
    max-width: 100%;
    max-height: 80vh;
    overflow: auto;
    border-top: 1px solid #ddd;
    border-bottom: 1px solid #ddd;
    padding: 0!important
}
.sticky-table table {
    margin-bottom: 0;
    width: 100%;
    max-width: 100%;
    border-spacing: 0
}
.sticky-table table tr.sticky-row td, .sticky-table table tr.sticky-row th {
    background-color: #fafafa;
    border-top: 0;
    position: relative;
    outline: #ddd solid 1px;
    z-index: 3
}
.sticky-table table td.sticky-cell, .sticky-table table th.sticky-cell {
    background-color: #fafafa;
    outline: #ddd solid 1px;
    position: relative;
    z-index: 3;
}
.sticky-table table tr.sticky-row td.sticky-cell, .sticky-table table tr.sticky-row th.sticky-cell {
    z-index: 4
}

HTML Table

<div style="white-space: nowrap; height: 60vh;" class="sticky-table sticky-headers sticky-ltr-cells" id="divTableContainer">
    <table class="table table-striped">
        <thead>
            <tr class="sticky-row">
                <th class="sticky-cell"> </th>
            </tr>
        </thead>
    </table>
</div>

HTML Modal

<div class="modalMenu">
    <div class="modal-success-message-content"> <b>SUCCESS: </b>
    <span id="modalSuccessMessageMsg"></span> </div>
</div>

Javascript for the Headers

jQuery(document).on('stickyTable', function() {
    $(".sticky-headers").scroll(function() {
        $(this).find("table tr.sticky-row th").css('top', $(this).scrollTop());
        $(this).find("table tr.sticky-row td").css('top', $(this).scrollTop());
    });
    $(".sticky-ltr-cells").scroll(function() {
        $(this).find("table th.sticky-cell").css('left', $(this).scrollLeft());
        $(this).find("table td.sticky-cell").css('left', $(this).scrollLeft());
    });
    $(".sticky-rtl-cells").scroll(function() {
        var maxScroll = $(this).find("table").prop("clientWidth") - $(this).prop("clientWidth");
        $(this).find("table th.sticky-cell").css('right', maxScroll - $(this).scrollLeft());
        $(this).find("table td.sticky-cell").css('right', maxScroll - $(this).scrollLeft());
    });
});
$( document ).ready(function(){
    $( document ).trigger( "stickyTable" );
});

Answer №1

To enhance the visibility of your .modalMenu, consider increasing its z-index.

.modalMenu{
     z-index:99999; // adjust number according to your specific site requirements
}

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

Injecting services differently in specific scenarios in AngularJS

I have a unique angular service called $superService that I utilize across many of my directives and controllers. However, there is one specific directive where I want to implement the following behavior: If another directive utilizes $superService in its ...

Populate an HTML select with data as users click the create button

Encountering an issue when loading data into an HTML select after users press or click a button. The situation is as follows: A button is available to create another button dynamically Upon clicking the created button, a form is displayed Once the form i ...

Looking to add tiered custom attribute select boxes in SnipCart - how can I make it happen?

I am interested in implementing two custom attributes for products, where the options for the second custom attribute are determined by the selection of the first attribute. My specific situation involves selling art in various formats and sizes, with dif ...

Is there a way to ensure that the vertical scrollbar remains visible within the viewport even when the horizontal content is overflowing?

On my webpage, I have multiple lists with separate headers at the top. The number of lists is dynamic and can overflow horizontally. When scrolling horizontally (X-scrolling), the entire page moves. However, when scrolling vertically within the lists, I wa ...

What is the best way to accommodate 4 columns within a 3-column HTML table layout?

I am facing a challenge with my table layout. Normally, it has 3 columns, but I am trying to figure out how to fit 4 cells into one row while maintaining the same width. Any suggestions on how to achieve this? ------------- | 1 | 2 | 3 | ------------- | ...

Is there a way to make this hamburger menu change into an "x" when clicked?

After trying numerous CSS and jQuery techniques without success, I am struggling to transform my hamburger menu into an X shape. Despite my efforts with rotating the lines using CSS or trying jQuery methods, I can't seem to get it right. The menu does ...

Utilizing Google Maps API version 3 to display various groups of markers

I am encountering an issue while trying to plot fixed markers and a user position marker on a Google Map. I want to use different images for these markers, but something strange is happening. When the page loads, all fixed markers show up correctly initial ...

Organizing images in a straightforward parallel array accompanied by navigation buttons for easy browsing

Recently, I've delved into JavaScript and am seeking guidance on creating a basic slideshow using an array of pictures. The idea is to click next or previous buttons to cycle through different images. How can I achieve this? Here's what I have s ...

Tips for updating the color of the bootstrap well component

Recently, I embarked on my journey to learn PHP and encountered a challenge in changing the color of a well. After some research, I stumbled upon this code snippet: .well.homefull{ background: rgba(0, 0, 0, 0.4); } The confusion arises when it comes ...

Why is my JavaScript code running but disappearing right away?

I've encountered an issue with the code I wrote below. It's supposed to display the user's names when they enter their name, but for some reason, the names keep appearing and disappearing immediately. What could be causing this problem? Her ...

Discover the technique for choosing an element within an IF statement using the keyword (this)

I am currently implementing bootstrap validation in my project. Here is the JavaScript code I am using: My goal is to achieve the following: $("#create-form").submit(function(e) { if ($("input").val() = "") { $(this).addClass("is-invalid"); ...

Is it possible for a website administrator to view the modifications I have made to the CSS and HTML code?

Is it possible for a website to detect any temporary changes made to their CSS or Html through developer tools, even though these changes are not permanent? ...

Applying font size constraints in TailwindCSS

Is it possible to implement the clamp() CSS function with TailwindCSS in order to create linear scaling for the fontSize within a defined range? I am specifically curious about how this can be integrated with Next.js. ...

Guide to updating a SQL value via a button click using PHP

Unsure of the amount of code required for my project, so any guidance is appreciated! I am currently working on the admin-end of a PHP project that utilizes SQL. The admin has the ability to update, remove, and promote normal users to administrators (some ...

Aligning the text in the header cell of a table

I'm struggling to center align the headers of a table. Below is the HTML code for the table: <div class="table-responsive"> <table class="table"> <thead> <tr> <th>Photo</th> <th>Descrip ...

Facing continuous 404 errors while working with nodejs and express

While attempting to collect data from a local host webpage's registration form that captures user information, I encounter an issue upon pressing the submit button A 404 Error is displayed stating "page not found", preventing the collection and out ...

Troubleshooting IE8 Problem with CSS Table Cell

Wondering if this is an easy fix :) I have a website with the following CSS styles: .gameboard-table { border: solid 3px black; padding: 0px; border-collapse: collapse; } .gameboard-table tr { padding: 0px; margin: 0px; } .gameboard- ...

Developing a Jquery solution for creating radio buttons layout

Looking to create a radio button functionality within different groups using multiple select. For Group A: If the user selects A1, then it should automatically deselect A2 and A3. If the user selects A2, then it should automatically deselect A1 and A3. I ...

Using jQuery to append text after multiple element values

I currently have price span tags displayed on my website: <div> <span class="priceTitle">10.00</span> </div> <div> <span class="priceTitle">15.00</span> </div> <div> <span class="priceTitle">20.0 ...

Assigning a distinct identifier to every item in a dropdown list in MVC

I'm struggling to assign a unique ID to each element in a SelectList (using @Html.DropDownListFor). The current structure of the div in the view is as follows: <div id="Courses"> @Html.DropDownListFor(c => c.Courses, new SelectList(Model ...