Can I set a nested DIV to a higher z-index than a parent DIV in IE7, so that it appears above it?

UPDATE!!!

Apologies for the confusion, it turns out the issue was with the #container DIV missing "float:left;". Please check the HTML rendering in Firefox and IE7 to see the impact!

I am facing difficulty getting a nested DIV to appear above another nested DIV using z-index. Despite setting a higher z-index value for the lower nested DIV, the overlay keeps covering it. Is this a limitation in IE7?

While Firefox displays the blue #details above the green #overlay, IE7 places the blue #details below the green #overlay.

UPDATE2: After some troubleshooting, adding "z-index:99;" to the #container style causes the .item divs to show up (though incorrectly in both Firefox and IE). These elements should be positioned under the overlay. Interestingly, removing the #container z-index helps display them correctly in Firefox but not in IE...

<html>
    <body>
        <style type="text/css">
            .item {
                float:left;width:75px;height:75px;background-color:red;
            }
        </style>
        <div id="main" style="position:relative;">
            <!-- This div should cover everything except #details -->
            <div id="overlay" style="position:absolute;
                                     top:0px;
                                     left:0px;
                                     width:500px;
                                     height:500px;
                                     z-index:1;
                                     background-color:green;"></div>
            <div id="container" style="position:relative;float:left;">
                <!-- These divs are intended to remain hidden under the overlay -->
                <div class="item"></div>
                <div class="item"></div>
                <div class="item"></div>
                <div class="item"></div>
                <div class="item"></div>
                <!-- This div should be on top of the overlay -->
                <div id="details" style="position:absolute;
                                         width:200px;
                                         height:200px;
                                         background-color:blue;
                                         left:400px;
                                         z-index:99;"></div>
            </div>
        </div>
    </body>
</html>

Answer №1

In order for this to function properly in IE7, I suggest raising the z-index of #container.

For more information, you can view the image at: alt text http://img529.imageshack.us/img529/6416/24042958.jpg

Answer №2

It seems like IE7 won't allow you to achieve that without tweaking your markup.

#container will remain in front of #overlay unless given an absolute position and adjusting the z-index accordingly. However, changing the z-index of #container to -1 will also cause its child #details to move behind it.

Setting .items z-index to -1 is not a viable solution either.

If moving #details outside of #container isn't possible, I can't offer an alternative without understanding your end goal and limitations. Could you provide more details on why you need the overlay? Is it meant to be transparent or solid? Do you want to ensure that .items are not hidden behind the overlay?

Are you able to utilize JavaScript libraries like jQuery to relocate #details within the DOM?

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

Nextjs exposes a bug in react-bootstrap's navbar component

After integrating react-bootstrap with nextjs, I encountered a strange issue with the NavBar component. The problem arises when I first load the navbar - everything appears as expected, https://i.stack.imgur.com/R9guE.png but upon refreshing the page, CS ...

javascript for each and every textarea

I am looking to apply my JavaScript code to all the Textarea elements on my page. $_PAGE->addJSOnLoad(" $('.textarea').each(function() { $(this).keyup(function() { var characterCount = $(this).val().length; var mes ...

I am attempting to create a stylish border for the .navbar-collapse element, but unfortunately, my efforts have been unsuccessful so far

I need assistance with adding a border around my mobile drop-down menu. I've tried using .navbar-collapse but it's not working. Any suggestions? Here is a sample image of the mobile size: https://i.sstatic.net/O9oA1.png Below is my code: < ...

An abundant array of options spread across numerous dropdown menus

I have been tasked by a client to do something new that I haven't done before, so I am seeking the best approach. The project involves creating a form with three dropdown menus where users can select from thousands of options. For instance: Users mu ...

Animating file transfer can be achieved using either JavaScript or CSS

My goal is to create a visual representation of file transfer, such as moving a file from one folder to another. I have successfully achieved this using JavaScript with the following code: <script type="text/javascript> var img; var animateR; var an ...

Preventing duplicate submissions in Ajax by serializing form data

I'm having trouble preventing double submissions on my form when I rapidly press the button that triggers a click event. I attempted to disable the button after a successful submission, but it still submits twice. Here is my code: <script> $(do ...

Creating a dynamic table with columns of fixed width in Angular on the fly

I am struggling to create a data table with fixed column widths (20% each). I have incorporated div elements in my table structure to enable dynamic row creation using Angular, but this has caused some design issues. My goal is for all rows to occupy 100% ...

The .keypress() function isn't behaving as expected

I've encountered a coding dilemma. Below is the code in question: $(document).ready(function () { var selectedDay = '#selected_day'; $(function () { $("#date").datepicker({ dateFormat: "DD, d M yy", a ...

Obtain the final output of a specific class utilizing jQuery

My HTML table structure is as follows: <tbody id="letter-list"> <?php $index = 0; foreach($letters as $letter) { $index++; ?> <tr id="letter-<?php echo $index; ?>"> <td><?php echo $l ...

The Bootstrap Carousel is failing to respond as expected

Having some trouble incorporating a carousel on my landing page. I can see the first image, but the carousel isn't sliding to the next one. I copied the template from bootstrap-carousel, but even the data-bs-interval attribute isn't responding. M ...

How can I prevent tinymce from stripping out my <link> tag?

I'm having an issue with tinymce. dd<script id="kot-id" src="***insert link here***"></script><div id="kotcalculator"></div><link rel="stylesheet" href="***insert link here***" type="text/css" media="screen" /> It seems ...

Incorporating docsify CSS styling into Markdown within the VScode environment

When it comes to building my blog, I've decided to go with docsify and manage my markdown files using VScode. I wanted a preview of my blog, and after noticing that <link rel="stylesheet" href="//cdn.jsdelivr.net/npm/docsify@4/lib/t ...

Display a scrollbar for the offspring of an element with a flex-grow value of 1

I'm seeking to create a straightforward design consisting of a layered header, main section, footer. My framework of choice is bootstrap 5. The complete layout should occupy all available width and height, with overflow (x and y) set to hidden. Hea ...

Exploring the Contrast between Using @import for Styles and js Import for Webpack Configuration

While delving into the source code of ant-design, I couldn't help but notice that each component has both an index.ts and a index.less file in the style folder. This got me thinking - why is JavaScript being used to manage dependencies here? What woul ...

Discreet elements are not functioning

It's frustrating that everything in the 'wrapper' won't stretch to fit properly, instead staying at a fixed height. I'm trying to make the 'sidebar' and 'content' inside the area have the same height at all time ...

Activate event starting from parent and ascending through child nodes

When I have a table inside a <div class="timely"></div>, and within that table is a <th class="prev"><i>previous</i></th>, Chrome developer tools show an event listener on the <th>. However, Firefox developer tools ...

Trigger a change event for a Material Checkbox by referencing its unique identifier

<div *ngFor="let cus of deselectedList | keyvalue" (click)="clickCheckBox('customer_'+cus.key+'_checkbox')"> {{cus.key}} <mat-checkbox id="customer_{{cus.key}}_checkbox" (change ...

Obtain the state name after selecting it from the drop-down menu and clicking the submit button (part 3)

Read more about passing city names from PHP to JS in the second part of this discussion on Stack Overflow. This is the JSON data for states ($stateJsonObject): Array ( [0] => stdClass Object ( [stateId] => s1 [stateName] => Kuala Lumpur) ...

Tabindex malfunction in Bootstrap dropdown menu when nested within a form and pressing Enter key

Within my form, I have integrated a Bootstrap 3 dropdown menu situated between two text input fields. The dropdown's role="menu" attribute allows for navigation using the up/down arrow and Enter keys. However, after making a selection in the dropdown ...

React Sticky sidebar implementation throughout the various components

My goal is to implement a sticky sidebar that moves smoothly across specific components on my webpage. The challenge I am facing is that the CSS 'sticky' property only allows movement within the component it was created in. So, my question is - w ...