IE 11 does not support the use of absolute positioning with a height of 100%, however, this functionality works perfectly on Microsoft Edge

It appears that in IE 11, my absolutely positioned element is not displaying within another element with a height:100%. Strangely, it only works if I assign a fixed height to the element (even though its parent has a fixed height).

Here is the HTML code:

  <div class="parent-table">
    <div class="parent-cell">
      <div class="child">
      </div>
    </div>
  </div>

And here is the CSS code:

html,
body {
  height: 100%
}
.parent-table {
  display: table;
  table-layout: fixed;
  position: relative;
  height: 400px;
  width: 100%;
}

.parent-cell {
  height: 300px;
  background: blue;
  position: relative;
  width: 100%;
  display: table-cell;
}

.child {
  position: absolute;
  top: 0;
  bottom: 0;
  height: 100%;
  background: red;
  width: 100%
}

You can view a live example of the issue on this JSFiddle link.

  • In Edge, the red box displays as expected.
  • However, in IE 11, only the blue box is visible and the absolutely positioned element is missing.

Answer №1

This issue has been causing frustration for many users over a long period of time. In order to resolve this bug in Internet Explorer, it is necessary to include an intermediate element (now utilizing the child class) inside the cell before adding an absolutely positioned element (now using the inner-child class) within it. The structure should look like this:

<div class="child">
  <div class="inner-child">
  </div>
</div>

The intermediate element needs to be styled as follows:

.child {
  display: inline-block;
  width: 100%;
  height: 100%;
  position: relative;
}

You can find a working solution for IE11, which also works on previous versions, in the following fiddle link:

https://jsfiddle.net/efvLdmtt/7/

Answer №2

To solve the issue, add overflow hidden to the parent element and set bottom: -100% to the child element, which should be positioned absolutely.

In my scenario, it was a pseudo element causing the problem.

The Problem on Internet Explorer --> Click here for visual reference

After Applying the Solution --> See the fixed version here

.contact-box-parent {
   display: table-cell;
   overflow: hidden;
     &:before {
       content: '';
       background: @white;
       position: absolute;
       top: 0;
       bottom: -100%; 
       left: 15px;
       right: 15px;
       z-index: 0;
     }
  }

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

Is there a way to align these blocks in a single row?

Having trouble aligning these buttons horizontally. Any suggestions? I've been tinkering with this for a couple of hours now, so decided to seek help here. The desired effect should resemble the image below, but it's not quite there yet. Thank yo ...

Combining Bootstrap navbar with React Router for seamless navigation

I am new to using React and I am having trouble linking pages with Bootstrap navigation. I am attempting to use React Router DOM to navigate to different pages on click, but the app is not compiling because BrowserRouter is not being imported properly. I c ...

Utilizing pixel values for Material-UI breakpoints rather than using the default sm, md, lg, xl options

Below is the code snippet that I am using: [theme.breakpoints.only('lg')]: {} The above code works perfectly and shifts at the desired breakpoint. However, when I implement the following: [theme.breakpoints.between('1200', '1021&a ...

Animation event in CSS3 fails to trigger on Firefox browser

Exploring the potential of CSS3 animation to detect when an input transitions from the enable to disable state, I encountered a challenge specifically in Firefox. Here is the code snippet that showcases the issue: View Demo on jsFiddle HTML: <input t ...

Is there a way to include a tag as an argument in a scss mixin?

Currently, I am working on a mixin that will target a specific child element within a parent. For instance, my goal is to target all <a> tags within a parent element that also has a parent of section---blue. I initially thought that passing the tag ...

Automatically resizing images in a canvas when their resolution exceeds the canvas size in HTML5

I am currently using Html5, fabric.js, and JavaScript to upload multiple images to a canvas. However, there are instances where the uploaded image size exceeds that of the canvas. I am looking for a way to ensure that the image is set to a fixed size. v ...

Struggling to incorporate a three-strike mechanism into my JavaScript game

I need to implement a feature where the user can make up to 2 mistakes before losing the game. Here's what I need to do: - Set up a global variable to keep track of the number of mistakes - Initialize this variable during the startGame function - M ...

I have successfully implemented a click effect on one image and now I wish to apply the same effect to the remaining images

I've exhausted all my options and still can't crack this puzzle. Let me break it down for you: Upon entering the page, users are greeted with a collection of images each tagged with classes (for example, img01 and img02). When an image is clicke ...

What is the best way to prevent an element from reaching the border of the screen?

As a JavaScript beginner, I am working on creating a simple game. My objective is to prevent the player (20px x 20px) box from causing the screen to scroll. I want a fixed screen where the player cannot go beyond the edges of the screen. Below are my previ ...

Encountering an error in an Angular 4 application when running in Internet Explorer 11: "Unable to execute code from a script that has been freed

I am encountering an issue with my Angular app, which I believe is running version 4. The problem arises in Internet Explorer 11 during a login sequence and the error message states "Can't execute code from a freed script". The IE console points to li ...

Ways to center an image within a div using Bootstrap 4

I am currently using Bootstrap version v4.0.0-beta.3 and facing a challenge with aligning an image in the absolute center of a fixed-height div tag. While I have successfully aligned the image horizontally using the mx-auto and d-block classes, I am strugg ...

Modifying CSS using jQuery in a PHP While Loop

I've been racking my brain trying to solve this issue, experimenting with different approaches but so far, no luck. Question: How can I dynamically change the color of a specific div within a PHP while loop using jQuery after receiving an AJAX respon ...

What is the HTML code to display a table and a video/image side by side?

I'm facing a challenge while trying to create a website. I want to place a table in the center of the page, with videos on either side of it. However, whenever I attempt this, the table ends up below the videos instead of being aligned with them. I&ap ...

How to make browsers refresh cached images

.button { background: url(../Images/button.png); } Issue: To improve performance, static content on the website is cached with expiration headers. However, when an image changes, users must manually refresh their browser cache (Ctrl+F5 in IE). ...

The Challenge of CSS Transition and Checkbox Label Discrepancies

I'm looking to adjust the position of my label when a checkbox is checked. Everything works smoothly if I don't include a transition for the top offset property in the CSS of my label. However, when this transition is added (as seen in the commen ...

Solving layout issues / Techniques for determining element heights

This new question is in relation to my previous one: How to position relative elements after absolute elements I have updated the JsFiddle from that question to better represent my current HTML, which I unfortunately do not have a URL for at the moment. Y ...

Master the Art of Scrollbar Control in Angular!

I am currently developing a chat web application that functions similar to gchat. One of the key features I'm trying to implement is an alert notification when the scrollbar is in the middle of the div, indicating a new message. If the scrollbar is at ...

Is it recommended to include the size of the box-shadow in the overall dimensions of the element?

I'm aware that by default it doesn't behave this way, but I'm attempting to make it do so. I'm in the process of constructing a button-shaped anchor with a solid box-shadow (no blur) to give the appearance of depth, and upon hovering, ...

css: text not enclosed by a span tag

I created an HTML-CSS demo with two simple span tags. I added some content to each span, and applied the same CSS code to both. Surprisingly, the content of the right span goes beyond the border, while the content of the left span stays within the border. ...

Enhance Your Charts: Learn how to dynamically adjust zoom levels between two timestamps with just a simple form submission

I have a Zingchart Area Graph that displays events on a timeline with time on the X-Axis. I want to be able to automatically zoom into a specific timeframe on the graph based on user input from a form. For example, if a user selects a start time of 8 AM an ...