In Internet Explorer, a nested table with 100% height extends beyond the boundaries of the

Check out this code snippet that exemplifies my issue:

<!DOCTYPE HTML>
<html>
    <head>
        <style>
            html, body {height:100%;margin:0;padding:0;}
            table {border-collapse:collapse;}
        </style>
    </head>
    <body>
        <table width='100%' height='100%'>
            <tr>
                <td>
                    header
                </td>
            </tr>
            <tr>
                <td valign='top' height='100%'>
                    <table width='100%' height='100%' bgcolor='red'>
                        <tr>
                            <td>test</td>
                        </tr>
                    </table>
                </td>
            </tr>
        </table>
    </body>
</html>

The webpage I'm constructing consists of a header and a table beneath it. The table should occupy all the available vertical space without exceeding the screen height. While this code performs as expected in FF/Chrome/Safari, IE exhibits an issue where the nested table extends beyond the screen height due to the presence of the header, resulting in an unwanted vertical scrollbar.

Any ideas on how to resolve this problem?

Answer №1

When it comes to calculating heights in tables, IE falls short. Instead of adjusting the cell height based on its parent container, it sets it to 100% of the body and html, causing layout issues.

To work around this issue, you can use a simple but not-so-elegant hack by placing

<!–- For Internet Explorer -–>
above <!DOCTYPE HTML>. This will force IE into quirksmode and should solve the rendering problem in your specific case. Be sure to restart IE instead of just refreshing the page after making this change.

Answer №2

Modify

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

so that it becomes

html, body {height:100%;margin:0;padding:0; overflow-y: hidden;}     

This adjustment will eliminate the vertical scroll-bar in Internet Explorer (or any other web browser).

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

Safari seems to have trouble running Javascript, unlike all the other browsers which handle it just fine

I've encountered an issue with a script that duplicates form fields when a "Same as Billing" checkbox is checked in one form and transfers the data to another. Everything works smoothly except in Safari, where it fails to transfer the state selection ...

Drop draggable items on top of each other

I'm wondering if there's a way to drag jQuery elements into each other. To illustrate my question, I've duplicated this code (link) and made some style changes. Here is the updated version: Fiddle Link. In the current setup, you can drag e ...

The Eclipse software is unable to detect the external CSS files

Whenever I apply external CSS to my screen, the JSP page seems to be unaware of the Bootstrap CSS. https://i.sstatic.net/DYGKQ.png https://i.sstatic.net/QUYnI.png ...

What is causing Safari to block styling for <em> elements in RESET.CSS only?

I am utilizing Eric Meyer's reset.css file, which can be found at this link: Interestingly, my <em> definition in my main stylesheet is working perfectly fine on all browsers except Safari. Somehow, only in Safari, the styling for italics is no ...

Experiencing difficulties with retrieving form data in req.body using Express and node.js

I am facing an issue while trying to create a registration form for new users with profile picture upload. Despite adding body-parser middleware, the form data is not passing correctly to the route and I cannot identify the reason behind it. Error: D:&bso ...

Angular: Disabling a button based on an empty datepicker selection

Can anyone help me figure out how to disable a button when the datepicker value is empty? I've tried using ngIf to check if the datepicker is empty and then disable the button, but it's not working. My goal is to make the button unclickable if th ...

Styling Your Pricing Table with a Unique Bootstrap Card Design

Today, I've been working on the bootstrap card lesson and followed along with my teacher. However, the grid markup effect isn't functioning as expected. Initially, I doubted myself and thought I had inputted something wrong, but upon closer insp ...

Error encountered while trying to load the fonts

Upon attempting to load fonts into the Spectacle boilerplate, I encountered the following error message: Failed to decode downloaded font: http://localhost:3000/assets/fonts/Overpass-Bold.ttf OTS parsing error: invalid version tag I've includ ...

Issue encountered when submitting form: Error identified as "Unexpected string expression without template curly in string"

As a novice in React.js, I am facing an issue where setState is not functioning properly when submitting a form. Any suggestions on how to resolve this problem? > class Home extends Component{ constructor(props){ > super(props) > ...

Why is it that the border size in Chrome browser always seems to change, despite my specific requests for a set size?

I need help understanding why the border size is not matching the size I set in my CSS rules. Here is a link to the fiddle and below is the HTML code: <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>P inside B ...

Stopping an HTML5 range input at a specific number: Tips and tricks

Does anyone have suggestions on how to use angularjs to stop a range slider at 75? I attempted it but it doesn't seem like the best approach. Any guidance would be appreciated. [EDIT for clarification after max=75 answer] Just to clarify, I want to di ...

Leveraging the power of Jquery's .each method inside a PHP foreach iteration

I am new to utilizing jquery, and I encountered an issue with using the .each function within a php foreach loop. I am attempting to create a table that calculates quantity, unit price, and total price. Since I don't know how many table rows the user ...

How to Align Title in the Center of a Section Containing Multiple Images?

I have a situation where I am using a StyledHead section to display 10 images from an API. The images are wrapped in another section called StyledHeader, which also contains an h1 element. How can I center the h1 element both vertically and horizontally so ...

capturing a different attribute within the same <tr element using web scraping techniques in VBA

My goal is to extract the WIN stats of a specific team from a table. To achieve this, I iterate through each //tr//span element in the table using an if condition to check if the team name is present. If it is, I then navigate back with Selenium xPath to t ...

How to extract a div from its parent using jQuery

I need to stack two div boxes on top of each other, and my goal is to hide the upper one when it's being hovered over. HTML: <div id="left_middle"> <div id="rfinder_UP"></div> <div id="rfinder_DWN"></div> </div> C ...

I'm having trouble getting the float left to work properly in my HTML/CSS code

Currently, I am diving into the world of HTML / CSS on my own. After following some tutorials, I have taken the leap to work on my very first project. My goal is to layout three images and three text elements on a single page using CSS. The desired struct ...

Steps to minimize the Bootstrap expanded menu on devices such as iPhone, iPad, Smartphones, tablets, etc. by simply tapping outside of the menu

Hello there! I'm currently working on a website project using Bootstrap framework v2.0.1. One interesting challenge I'm facing is related to the navigation menu behavior on different devices such as iPhones, iPads, tablets, and smartphones. When ...

Javascript issue: opening mail client causes page to lose focus

Looking for a solution! I'm dealing with an iPad app that runs html5 pages... one specific page requires an email to be sent which triggers the Mail program using this code var mailLink = 'mailto:' + recipientEmail +'?subject=PDFs ...

Tips on retrieving data from a php dropdownlist filled with values from a mysql database

After spending significant time scouring the Internet and rewriting various scripts, I have yet to find a satisfactory solution to my dilemma. Even after searching this platform for similar inquiries, it appears that most discussions center around displayi ...

Replicating the existing div content into a textarea

I wanted to create a tool for my workplace as a learning project in html, CSS and JS. It's a timer that tracks how long I spend on tasks. Currently, I have the timer resetting itself but I'm facing an issue where the paused time is not being log ...