The margin-bottom property displays correctly beneath a floating element on Chrome and FireFox, but fails to function on Internet Explorer 10

I am facing an issue with creating a margin underneath my floated element to separate it from the footer. The margin works perfectly in FireFox and Chrome, but not in Internet Explorer 10. Can anyone help me fix this problem? Here is the HTML code:

<div id="wrapper">
  <div id="mainfloat">
    <div class="text_body">
      Text goes here
    </div>
  </div>
</div>
<div id="footer">
  Footer goes here.
</div>

Below is the relevant CSS code:

#wrapper {
    min-height:100%;
    position:relative;
    width: 100%;
}

html {
    position: relative;
    min-height: 100%;
}

body {
    margin: 0 0 100px; /* bottom = footer height */
}

#mainfloat{
    float: left;
    position: relative; /*also important to add*/
    background-color:#FFF;
    font-family: Arial, Helvetica, sans-serif;
    opacity:0.9;
    filter:alpha(opacity=90); /* For IE8 and earlier */
    min-height: 550px;
    min-width: 650px; /*this was commented out earlier*/
    max-width: 900px;
    margin-left: 15%;
    margin-right: 17%;
    margin-top: 40px;
    margin-bottom: 220px; /*makes space between float and footer*/
    padding:10px;
}

#footer{
    min-height: 50px;
    max-height: 200px;
    min-width: 800px;
    width: 100%;
    background: black;
    bottom: 0;
    position: absolute;
    color: #FFF;
    font-family: Arial, Helvetica, sans-serif;
}

Answer №1

One solution to consider is including "display: inline-block" in the #mainFloat rule before setting any margins. If this doesn't resolve the issue, you could also create a CSS rule specifically for Internet Explorer that includes "margin-top: 220px". Internet Explorer has been known to behave oddly at times.

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

Inverting the colors of the image and changing the background color

I have a blend of blue and white image with a white background. When the div is clicked, I want to switch the colors around (background to blue and blue part of the image to white, white part to blue). Html : <div class="col" ng-click="onHomeButtonCli ...

Is it possible to embed HTML code within JavaScript strings?

Is my approach to inserting HTML into a JavaScript string correct? In particular, I want to insert an HTML link into a div tag using JavaScript. Here is the HTML: <div id="mydivtag"></div> And here is the JavaScript code: document.g ...

Enhance the styling of elements generated through JavaScript in VueJs with custom CSS

I need help applying CSS to elements that I dynamically created using JavaScript. buttonClicked(event) { console.log(event); let x = event.clientX - event.target.offsetLeft; let y = event.clientY - event.target.offsetTop; let ripples = document.cre ...

Ways to incorporate a smooth transition between the opened and closed fab functionality

I am currently utilizing VueJS and Vuetify in my project. I have successfully implemented Vuetify's FAB component, which displays a list of fab buttons as demonstrated in the documentation: <div id="fab-button"> <v-speed-dial v-mo ...

Distribute uniform width among child elements using CSS styling

In a fixed-width area, I may need to place either four divs or two divs based on different circumstances. If there are only two divs, they should occupy 50% of the width each: On the other hand, if there are four divs, they should be stacked like this: ...

Attempting to modify the contents of a div by utilizing the CSS :hover pseudo-class

I recall seeing this technique used before, but I am struggling to remember where. My goal is to modify the content of a div when the css :hover state is activated. Below is the CSS code that I am attempting to make work: .mWin_close:hover div.new-label ...

What's the name of the auto-triggered dropdown menu feature?

Visit Amazon's official website Description: Within the 'Shop by Department' section- A drop-down menu that remains visible without requiring you to hover over it. However, when the browser is in a non-full-screen mode, the menu disappears ...

Using a dashed border stroke creates a unique look when combined with border-radius properties

I have been experimenting with different methods to increase the distance between border strokes on my element. So far, I have tried various approaches without success. For example, I explored this resource Unfortunately, the issue arises when I incorpor ...

Incorporating Google fonts into email designs

I am struggling to get Google fonts to display properly in my newsletter emails. Here is the code snippet I have been using: $html=" <html> <style> @import url(http://fonts.googleapis.com/css?family=Lato|Simonetta); </style> <body& ...

Arranging Nav Items in a Stack with Bootstrap 4

Struggling to create a unique navigation bar design with fixed elements on both the left and right sides. The challenge arises when scaling down to mobile, as the icons on the right end up stacking. Any suggestions on how to resolve this issue? <div ...

Mastering the art of using transitions in conjunction with display properties

I'm trying to achieve a fade-in effect with the CSS property display:block. Here's my HTML code: <div>Fade</div> And here's my CSS code: div { display: none; transition: 2s; } div:hover { display: block; } Unfortunately, thi ...

Utilizing the canvas context to place an HTML5 element onto the canvas

Here's a code example where I am attempting to draw an object using context. An error is being thrown in Firefox 15: TypeError: el is null [Break On This Error] Even though GetElementById has been properly fetched, it still results in an error. I h ...

What is the method for showcasing login errors and prompting users to fill in all fields simultaneously on a page with PHP?

As I develop a PHP login page, I am implementing a system where users need to enter a username and password to access the platform. One query that arises is: How can I dynamically display an 'Invalid username or password' error message on the s ...

Ways to implement a 'Delete' feature in a PHP audio tag player

"I successfully retrieved the name of the uploaded file and am able to play it in my browser. How can I incorporate a delete function for each user-uploaded song?" echo "<hr />"; echo "<h4>" . $name . "<br /><a href='#' titl ...

Learn how to easily reset the index value within the same template in Angular

In my template, I have 3 tables with the same JSON data as their parent elements. <tbody> <ng-container *ngFor="let row of reportingData.RecommendationData; let i=index"> <tr *ngIf="row.swRecommendations"> <td& ...

Tips for merging identical media queries into a single query using SASS

Previously, I organized my media queries in LESS by combining them at a single place like this LESS: .media-mixin(@break) when (@break = 1200px) { .abc{ color: red; } } .media-mixin(@break) when (@break = 1200px) { .xyz{ color: yellow; ...

Is it possible to substitute the input field in the filter component with a Material UI text field instead?

I am attempting to replace the input field for filter components with a text field from materialUI. Despite successfully displaying the input field by creating a new component, it is not filtering contents as desired. My goal is simply to replace the inpu ...

stop cascading style sheets from being overwritten

In my ASP.NET web forms project, I am utilizing Telerik controls. The Problem In one instance, I need to retrieve HTML data from the database, which includes a lot of CSS, images, and HTML content. Here is an excerpt of my code: <telerik:RadLabel ...

Drifting my dropdown menu bar through the digital sea

I'm having trouble with my navigation bar and I need help styling it. I want the navigation bar to have a dropdown menu when the user hovers over the top level of the navigation bar. The issue I am facing is that the second level of the navigation bar ...

Transitions fail to appear correctly when the page first loads

I need to fill a gauge meter based on a variable sent to the html file. To achieve this, I have initially set the value to zero: transform:rotate(.0turn); transition: all 1.3s ease-in-out; However, when the HTML is first loaded or refreshed (with F5 ...