Can you identify the specific name of the IE CSS bug affecting double vertical padding?

(Just when I thought I've encountered all the strange IE CSS bugs, here comes another one. Is there a name for this double-vertical-padding bug?)

After creating a simple test case that worked perfectly in browsers like FF and Opera, I was surprised to find issues in IE 6 and IE 7. The page below illustrates the problem.

Edit: To view the issue, visit: http://jsbin.com/efele
Open it in both IE and FF to compare.

I'm curious, what is the official name for this bug? (Is it documented somewhere like on this page?) I have experience with other float-related bugs like the 3px jog bug and the double-margin bug, but encountering duplicated vertical padding is new territory.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>IE bork!</title>
<style type="text/css">
html, body {
 margin:0;
 padding:0;
}
#container {
 border:1px solid red;
 background-color:#CC99CC;
 width:800px;
 margin:0 auto;
 padding-top:100px;
}
#sidebar {
 float:left;
 display:inline;
 width:200px;
 border:1px solid blue;
 background-color:#00CCFF;
}
#content {
 float:right;
 display:inline;
 width:510px;
 border:1px solid green;
 background-color:#66CC99;
}
.clear {
 clear:both;
 /* height:0px; <<< setting height seems to be the only thing that makes this work as expected?!? */
 background-color:#CCCCCC; /* bg color here is just for debugging */
}
</style>
</head>
<body>
<div id="container">
    <div id="sidebar">I am the sidebar</div>
    <div id="content">I am the content</div>
    <div class="clear"><!-- clear! --></div>
</div>
<p>There should be 100px of space above the two floats, but <em>no</em> space below them...</p>
</body>
</html>

P.S., After much trial and error, I finally found a fix for the issue in IE. The solution involved explicitly setting a height on my "clear" div, which is currently commented out to showcase the bug. It's frustrating how much time I spent troubleshooting this!

Thank you!

Answer №1

It appears that the issue you identified is related to the hasLayout quirk in Internet Explorer. (By specifically defining the height on your clear div, it triggers the hasLayout attribute to become true in IE's perspective)

Answer №2

Just a quick tip: If setting the height doesn't seem to be effective for some reason, I've discovered that adding zoom:1; whenever I need hasLayout to activate in IE can make a huge difference. Whenever I come across strange layout problems in IE, my go-to first step is always trying this trick to see if it resolves the issue. (And if all else fails, then it's time to resort to banging my head against the keyboard!)

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

Ensure the TUMBLR og:image appears in larger dimensions for enhanced visibility [updated: additional code implemented]

I recently incorporated two widgets into my blog - one on the sidebar and another attached to each post. You can check them out at . To enhance the visual appeal, I uploaded a 900x900 og:image to the tumblr static servers, accessible through my FB Debug p ...

Flyer - Chart "dimmed" and unselectable when dimensions are specified as a proportion

I am currently working on displaying a map within a container. I have successfully been able to display the map by setting its size to a specified number of pixels. However, my goal is to have the height of the map adapt to the size of the container dynami ...

Is there a way to alter the background image of the logo specifically for mobile device viewing?

Here is a snippet of my HTML code: <nav class="navbar navbar-expand-lg navbar-light bg-light"> <a class="navbar-brand" href="{{ route('home') }}"> <img src="{{ asset('assets/images/logo-school-icon.png') }}" ...

Creating unique navigation bar elements

I'm currently working on an application and facing an issue with the navigation from the Component to NavbarComponent. If you'd like to check out the application, you can visit: https://stackblitz.com/github/tsingh38/lastrada The goal is to hav ...

Modify the button's background color for Django's image upload field

In one of the forms in my Django application, I have included a field that allows users to upload an image. Here is the code for this field: image = models.ImageField(upload_to=upload_location, null=True, blank=True) To display this field in my form tabl ...

Styling the Container Component in ReactJS

I need to apply some styling to the "Forms_formline__3DRaL" div (shown below). This div is generated by a component, but it seems that the style I want to add is being applied to the input instead of its parent div. How can I use ReactJS to set the style " ...

Safari displays an inexplicable gray border surrounding the <img/> element, despite the actual presence of the image

https://i.stack.imgur.com/4QR52.png There is an unexpected gray border visible around the dropdown image, as seen above. This occurrence has perplexed me because, according to several other queries, this problem arises when the image's src cannot be ...

Why are my AngularJs elements not appearing in the print dialog window?

Whenever I try to open the print Dialogue on a specific page, all I'm seeing is a blank screen. The majority of the content on this page consists of AngularJS elements. To trigger the print dialogue, I use the following code: <a href=""onclick="wi ...

Can you tell me where the templates store their icons?

Hey there, thank you for taking the time to read my question. I have a template that can be found at this link: In the top left corner of the template, there is an icon of a home. I have copied the entire website, including images, css, and js files, but ...

Text Parallax Effect

For my website, I am interested in incorporating a unique parallax effect. Instead of just fixing a background image and allowing scrolling over it, I want to apply this effect to all of the content on my site. The website consists of a single page with m ...

Invisible Thinglink image revealed upon resizing browser

I am currently repurposing a pre-existing theme that has a drop-down menu showcasing an image. I am attempting to integrate a Thinglink into the content section of this drop-down, but unfortunately, the image does not appear until I adjust the size of the ...

Is there a way to position these divs in a line using inline-block?

I need help aligning two divs with text differently - one to the top left and the other centered but not on the same line. Here's the layout I'm aiming for: ---------------------------------------------- |Backstage |Issue 4 | | ...

Persistent button positioned at the bottom of the page, remaining visible even when scrolling to the very end of the content

I am looking to add a floating button that remains in the same position relative to the content until the window is scrolled to a certain point, after which it sticks to the end of the content. In simple terms, I want the element to act as 'relative& ...

Keep the footer at the bottom of the screen without needing to define a 100vh in Material UI

In the process of developing my react app with MUI framework, I encountered various challenges in creating a sticky footer at the bottom of my screen. After exploring different solutions, one approach that I found most satisfactory is as follows: export de ...

Creating a Loop for Tabs on an HTML Form

When navigating through form input boxes using the tab key, it usually goes in order. However, I discovered that you can actually customize this order by using tabindex=x. Since I have 5 inputs on my form, I use tabindex 5 times to specify the order. But ...

Resizable Bootstrap column-md-4

I need to make a bootstrap column fixed position (col-md-4). This is for a shop layout with 2 columns: Shop content (long & scrollable) col-md-8 Cart content (short & fixed so it stays visible while scrolling the shop content) col-md-4 I'm ...

Tips on customizing the CSS responsiveness of your Bootstrap carousel

I have recently installed a Bootstrap theme on my Wordpress site and I am trying to make some CSS adjustments. One issue I am facing is with the carousel. Currently, when I resize the website or view it on a mobile device... The carousel maintains a lar ...

The final item in the navigation bar is off-center

After centering all text within the li tags, the last one appears to be slightly closer to the bottom. Below is the code snippet along with an image: *{ margin:0; padding:0; box-sizing:border-box} #hamburgerClick{ displa ...

a single column with a div of varying height using flexbox

I need to create a div with a height of 120px using only the CSS property display: flex. I am not allowed to use float and can only use div elements. Here is the code I have so far, but I'm unsure how to achieve the desired outcome: .flex-containe ...

Maintain visibility of the vertical scroll bar while scrolling horizontally

Currently, I am in the process of setting up a table with fixed headers and columns that have a minimum width. To ensure this setup functions correctly, I require both vertical and horizontal scroll bars. The vertical scroll bar should only navigate throu ...