Unable to set full height in Internet Explorer

I am encountering an issue with displaying divs at 100% height in Internet Explorer. The code works perfectly in other browsers, but for some reason IE is causing me trouble and I'm struggling to find a solution.
Here is a snippet of my code:
HTML:

<div id="content">

    <div id="box-01" class="slide" style="color: #F26964; background-color: #003218;">
        <div class="text-content">
TEXT GOES HERE
        </div>
    </div>


    <div id="box-02" class="slide" style="color: #F2F1EF; background-color: #70858E;">

            <div class="text-content">
TEXT GOES HERE
            </div>
    </div>


    <div id="box-03" class="slide" style="color: #F2F1EF; background-color: #003218">

            <div class="text-content">
TEXT GOES HERE
            </div>
    </div>

</div>

CSS:

html, body {
    margin:0;
    padding:0;
    height:100%;
    border:none
}

#content {
    width: 100%;
    height: 100%;
    margin: 0;
    position: absolute;
    top: 0px;
    left: 0px;
}

.slide {
    width: 100%;
    height: 100%;
    margin: 0 auto;
    text-align: center;
    position: relative;
    display: table;
    vertical-align: middle;

    background: no-repeat 50% 50%;
    -webkit-background-size: cover;
    -moz-background-size: cover;
    -o-background-size: cover;
    background-size: cover;
}

.text-content {
    text-align: center;
    display: table-cell;
    vertical-align: middle;
    text-transform: uppercase;  
}

I have a series of relatively positioned divs, each set to fit the size of the browser window. While this setup functions correctly in most browsers, IE seems to have difficulty recognizing the 100% height style attribute. My research indicates that this may be related to the text being in a table format (which is necessary for centering the text both horizontally and vertically). However, I am unsure how to address this issue. Any suggestions or solutions would be greatly appreciated!

Answer №1

Various techniques have been shared in this discussion:

This method seems to be effective in IE, Firefox, and Chrome: http://codepen.io/anon/pen/asqpL

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

Using JavaScript to create CSS animations triggered on hover

Looking for a CSS Animation that will play forward once when the mouse enters a specific div, and then play in reverse when the mouse leaves. Check out my JsFiddle here. The div with the class ".item" should trigger the mouse enter event. The animation co ...

swapping out button elements for visual images and positioning them next to a text input field

While many may find this simple, my CSS skills are a bit rusty and I am seeking the best solution for this issue. Below is my current HTML code: <div class="head_wrap"> <div id="logo"></div> <div id="search"> <form action=""> ...

What type of Javascript is required for a photo carousel that displays random images from a designated folder?

I have a minor issue that has been keeping me up at night. I can't seem to shake it off and find the right solution! Currently, I am working with Bootstrap 4 as my Framework. My task is to create a full-page Carousel that cycles through images random ...

How to create a full-page image background using Bootstrap 4?

I am struggling to implement a full-page image background using Bootstrap 4, but unfortunately it's not working and I am unsure how to troubleshoot this issue. Despite conducting extensive research online, I have been unable to find a solution that ad ...

The left side of the page is anchored with text content while an engaging carousel occupies the right half

Looking to create a section on the website that remains fixed while a carousel scrolls vertically. Once you reach the final slide, scrolling will continue on the page rather than changing the carousel slide. Want it to function similarly to the Creative s ...

What is the impact of a floated element on vertical spacing?

I have come across an article discussing the usage of CSS, but I am puzzled as to why image number four is not positioned below image number one. Instead, it appears below image number three. Can someone please explain this to me? Here is the HTML code sni ...

"Encountering a Javascript issue while trying to apply a CSS class to a

Encountering issues in Safari desktop / mobile and Internet Explorer. The error message states: In Safari: TypeError: Attempted to assign to readonly property. IE Edge: Assignment to read-only properties is not allowed in strict mode The problem arises ...

Retrieving the textbox input and utilizing it as a filename in PHP

Currently, I am facing an issue where I want to use the value of a textbox as the filename for a downloaded file, but I am unsure how to achieve this. While my code successfully downloads the file, it does not allow me to utilize the textbox value as the ...

HTML row with interactive functionality that sends data via POST method to another PHP file

I am currently working on an HTML table where I am displaying data from a database. My goal is to make the entire row clickable so that I can trigger a PHP script using the data from that specific row as variables. However, I am facing a challenge in figur ...

The problem with div height, the div is not extending to cover the entire body

I am currently working on a slider panel that covers the full height when opened. However, I have encountered an issue where the height remains fixed and the full content is not displayed when setting the body overlay to hidden. More information can be fou ...

Trouble with a Userscript focused on Styling

Starting off by admitting my limited knowledge in coding, I am determined to finish this simple script. Despite being aware of the script's limitations, I am struggling to understand why it is not functioning as intended. I have attempted to utilize f ...

Ways to make a div fill the whole screen and allow for scrolling as well

Issue I'm facing an issue with the login.php screen and the addphoto.php screen. I want these screens to cover the entire page, but despite using the following code: .login-screen, .form-screen { position: fixed; top: 0; left: 0; disp ...

How can one loop through multiple elements at the same time in Jsoup?

My goal is to transform an HTML page containing entries with various details (such as name, phone number, and address) into a spreadsheet. I have managed to identify each of these details as Elements, but I am struggling to figure out how to iterate over ...

Recommendation for a reliable and user-friendly chat platform without the need for third-party involvement

I am in need of a chat room for a specific group of users on my social network. Ideally, I want a chat feature that is simple and does not require a third party. The chat should automatically use the user's name based on their authorized id when they ...

Is there a way to compress my JavaScript and CSS files using gzip?

I am facing an issue with gzipping a prototype library. I have no idea how to go about it, where to start, and how it actually works. I tried looking at some tutorials but unfortunately, they weren't very helpful... So here's the setup: I have ...

How can I prevent users from using the inspect element feature in Angular 4?

I have a collection of elements that I need to selectively display on a webpage. To achieve this, I am utilizing the following code snippet: [style.display]="!student.selected?'none':'block'" However, upon inspecting the element, a ...

How do I access the <div> element that is located near the current button using JavaScript and HTML?

When working with HTML, there is a scenario where I have the following code: <div> <button onclick="action()">button</button> </div> If for some reason, I haven't assigned an ID or class to the div element, how can I s ...

During the animation sequence, the element is seen ascending

I'm encountering a small issue with one of the elements I'm animating - it's moving up slightly during the animation process. It elevates about 2-3 pixels while the animation is playing, then snaps back down once it's completed. The el ...

Unable to examine a specific component

As I attempt to inspect an element by right-clicking and selecting "Inspect," I encounter the following details: Screenshot1 Screenshot2 Despite trying the code snippet below, it did not yield the desired results for me: driver.findElement(By.id("tmsMo ...

What enhancements does HTML5 provide for accessibility?

In what ways does HTML5 improve accessibility compared to HTML 4.01 or XHTML 1.0 Strict? ...