Trouble with CSS positioned image rendering in Internet Explorer? Z-index not solving the issue?

I've been working on a timeline project where the completed sections should have a green background with a check mark image in the foreground. It appears correctly in Firefox, Chrome, and Safari.

However, in IE 7 and 8 (and possibly 9), the layout is incorrect. I've tried various techniques like z-index manipulation but haven't found a solution yet. I even came across an article suggesting a potential fix, which unfortunately didn't work.

If anyone has any insights or suggestions on how to make the checkbox appear in front of the green background in IE, I would greatly appreciate it!

Below is a simplified version of my CSS:

    .timeline-container {
        width: 820px;
        height: 50px;
    }        
    .timeline-step {
        width: 164px;
        height: 22px;
        float: left;
        background: url(https://i.stack.imgur.com/amRJt.png) -10px 0px no-repeat;
    }                
    .complete {
        background: url(https://i.stack.imgur.com/NgSG6.png!) -10px 0px no-repeat;
        position: relative;
    }
    .complete img {
        position: absolute;
        top: 5px;
        left: 50%;
        right: 50%;
    }                
    .timeline-divider {
        background: url(https://i.stack.imgur.com/AJw3e.png);
        height: 30px;
        width: 1px;
        float: right;
    }        
    .timeline-label {
        color: #C5C5C%;
        font-size: 12px;
        font-weight: bold;
        width: 100%;
        display: block;
        float: left;
        text-align: center;
    }        

And here's a simplified version of my HTML:

<div class="timeline-container">
    <div class="timeline-step complete">
        <img src="https://i.stack.imgur.com/hS83c.png" alt="complete" />
        <div class="timeline-divider">
        </div>
        <span class="timeline-label">Confirm Eligibility</span>
    </div>
</div>

If you want to see the issue in action, you can check out this JFiddle link: http://jsfiddle.net/SY9q5/

Answer №1

To enhance the layout, include the following code in your CSS file: position: relative; z-index: 0; for the .timeline-container element.

After that, set a z-index value of greater than 0 for the parent tag containing your image.

For a visual representation and better understanding, check out this link: http://jsfiddle.net/5wsbC/

I hope you find this information helpful.

Answer №2

Avoid using position absolute as it may be causing the issue.

Instead, try this:

.complete img {
    padding-top:5px;
    display:block;
    margin-left:auto;
    margin-right:auto;
    z-index:10;
}     

Check out this example on jsFiddle

Answer №3

The culprit behind the issue is not an interaction with the container div .complete but actually your .timeline-divider. If you can modify the markup, a simple solution would be to wrap the lower two elements in another div:

<div class="timeline-step complete">
    <img src="https://i.stack.imgur.com/hS83c.png" alt="complete" />
    <div>
        <div class="timeline-divider">
        </div>
        <span class="timeline-label">Complete Application</span>
    </div>
</div>

Alternatively, you could add an empty div above .timeline-divider or rearrange the img element below the floats and apply clear: both; to it. While these solutions may not be perfect, they should resolve the issue.

It's important to mention that this bug is well-documented, as referenced in this article.

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

Arrange the bootstrap columns in a grid layout both vertically and horizontally adjacent to one another

I need help with displaying my columns in this specific layout https://i.stack.imgur.com/2hzju.jpg Code <div class="row"> <div id="id-orders-stats" class="col-md-6 col-sm-6"> </div> <div class="col-md-6 col-sm-6 stats-box"&g ...

How can I set a value using document.getElementById(idPopUPImage).innerHTML to create a static popup in Leaflet?

I added a leaflet map to my project which you can find on Codpen In the map, I've included a button key that displays an image in a popup when clicked. However, after closing the popup and reopening it, the image doesn't show unless I click the ...

HTML list with clickable elements for querying the database and displaying the results in a <div> element

Patience please; I am a newcomer to StackOverflow and this is my inaugural question. Struggling with writing an effective algorithm, I wonder if my attempts to "push" it forward are causing me to complicate what should be a straightforward concept, or if i ...

Concealing and revealing template URLs with AngularJS

I am currently working with a dynamic Array in my Controller that contains templates (html files) structured similarly to the example below: $scope.templates = [ { name: 'template1.html', url: 'template1.html'}, { name: ...

Exploring the internet with the advanced capabilities of Angular JS

Encountering an issue with Internet Explorer and angular js. The html code displays correctly in Chrome and Firefox, but content within the ng-view tags does not appear in IE. <html xmlns:ng="http://angularjs.org"> <html lang="en" ng-app="poc"&g ...

Is there a way to remove deleted SASS styles from the generated CSS?

Is it possible to remove markups from a generated css file using sass? For instance, in my scss file I have: body{ background:$dark; } The resulting CSS file looks like this: body{ background: #000; } If I delete that line of code in sass, what will h ...

Sorry, but we are experiencing difficulties processing your request at the moment. HTTP ERROR 500: We are unable to locate the

My code seems to be functioning correctly when connecting to the database, but I'm encountering an error. Here is the code snippet: <?php include 'header.php'; ?> <!DOCTYPE html> <html> <head> <t ...

What is the best approach to transfer information from the client side to a node

I have an ejs page that looks like this: <%- include('../blocks/header', {bot, user, path}) %> <div class="row" style="min-width: 400px;"> <div class="col" style="min-width: 400px;"> <div class="card text-white mb-3" & ...

Flexbox sets aside space for resized svg images

I am currently working on my site header and I want to implement flexbox for this purpose. I tried using justify-content: space-between; to evenly distribute the empty space between the divs. However, when I add an SVG image and scale it down to fit the ...

What is the best way to align text with my CSS number and circle on the same line?

Here are two questions for you: First off, I've successfully created a circle with a number inside it using CSS. How can I go about filling the circle with color? Secondly, I'd like to know how I can align the words "Opportunity #1" on the same ...

Tips for loading and updating data simultaneously in VUEJS from a single input

Currently, the data is displayed in a span tag with an input for updating it Is it possible to fetch data from an API, load it into an input field, update the input with new information, and send it back? What are the best approaches for achieving this? ...

Using single and double quotes in combination with brackets in PHP: a guide

My struggle lies in using single and double quotes along with brackets in PHP $nestedData[] = '<a href="JavaScript:newPopup('loghistory.php?logid='.$row['user_id'].'')"> History('.$countqry.')</a>&a ...

The text element does not line up with the icons

As I'm working on creating my first account page header, I've run into an issue with some of the icons not aligning perfectly with the text. While advanced developers may find this task simple, as a beginner, I could really use some advice on how ...

Remove the footer from the main section

I'm facing an issue with the web page layout of my website. Here is a snippet of the structure: <body> <div class="container"> <div class="sidebar"> </div> <div class="content"> </div> </div> < ...

Is there a way to invoke a function using $scope within HTML that has been inserted by a directive in AngularJS?

After moving the following HTML from a controller to a directive, I encountered an issue where the save button no longer functions as expected. I attempted to change the ng-click to a different function within the directive code, and while that worked, I u ...

Role-based dynamic layout

I am currently working on a website that requires user login functionality. To achieve this, I am utilizing materialise-css and Angularjs for the front-end development, while the back-end is powered by Java-Hibernate (as Spring is not an option in my case) ...

Struggling with setting up a search bar for infinite scrolling content

After dedicating a significant amount of time to solving the puzzle of integrating infinite scroll with a search bar in Angular, I encountered an issue. I am currently using Angular 9 and ngx-infinite-scroll for achieving infinity scrolling functionality. ...

Using jQuery to insert a div class with PHP referenced

My variable stores a color name. Here is an example: <?php $myvar = blueColour; ?> I want to apply this value to the body of an html page using jQuery: <script type="text/javascript"> jQuery(body).addClass("<?php echo $myvar; ?>"); < ...

Automatically switch slides and pause the carousel after completing a loop using Bootstrap 5 Carousel

Seeking assistance with customizing the carousel functionality. There seems to be some issues, and I could use a hand in resolving them. Desired Carousel Functionality: Automatically start playing the carousel on page load, and once it reaches the end of ...

Looking to connect information

I have written the following code and I am trying to bind data to ng-model. When I use ng-model = "value", I can see the value in the text field, but I want to update the value when the text input is changed. <tbody ng-repeat="action in model.editAct ...