Exploring the background positioning feature in Internet Explorer

Trying to create an icon using a background-image for a link, but encountering issues with positioning in IE. Made adjustments to position and display properties without success.

.page {
  color: #ffffff;
  height: 75vh;
  min-height: 850px;
  padding-bottom: 0;
}

.page ul.col-2 {
height: 100%;
padding: 0;
font-size: 0;
position: relative;
    background-color: #f49841;
}

.page ul.col-2 li {
  height: 100%;
  width: 50%;
  display: inline-block;
  font-size: 12px;
  vertical-align: top;
  overflow: hidden;
  position: relative;
}

.page ul.col-2 li ul.line-2 {
  padding: 0;
  height: 100%;
}

.page ul.col-2 li ul.line-2 li {
    list-style: none;
    vertical-align: top;
    width: 100%;
}

.page ul.col-2 li ul.line-2 li:nth-child(1) {
  background-color: #4286f4;
  height: 30%;
}

.page ul.col-2 li ul.line-2 li:nth-child(2) {
  height: 70%;
}

.page ul.col-2 li ul.line-2 li ul.col-2 {
  padding: 0;
}

.page ul.col-2 li ul.line-2 li ul.col-2 li {
  height: 100%;
  width: 50%;
  display: inline-block;
  vertical-align: top;
}

.page ul.col-2 li ul.line-2 li ul.col-2 li:nth-child(1) {
  background-color: #40ed48;
}

.page ul.col-2 li ul.line-2 li ul.col-2 li:nth-child(2) {
  background-color: #ed3f3f;
}


.page ul.col-2 li ul.line-2 li .my-link {
  background-image: url(https://upload.wikimedia.org/wikipedia/commons/1/16/Deletion_icon.svg);
  background-repeat: no-repeat;
  background-size: contain;
  background-position: right;
  padding-right: 30px;
  color: inherit;
  text-decoration: none;

}
...

Investigating further, the issue seems to be resolved temporarily inside the snippet.

Attached is a picture of the code: https://i.sstatic.net/uYd8d.png

Upon updating the code snippet to provide better context around the link, there's still a discrepancy in how it appears on my environment. Picture reference: https://i.sstatic.net/kcMTJ.png

It appears that the background-position remains centered regardless of the set value.

Answer №1

I successfully moved the delete icon css to the :after element and it is functioning properly in IE11. I believe this solution will be beneficial for you as well. Thank you.

.my-link {
      color: inherit;
      text-decoration: none;
    }

    .my-link:after {
      background-image: url(https://upload.wikimedia.org/wikipedia/commons/1/16/Deletion_icon.svg);
      background-repeat: no-repeat;
      background-size: contain;
      background-position: right;
      padding-right: 30px;
      content: '';
    }

.my-link:hover {
  color: red;
}

.my-link:hover::after {
  background-image: url(https://cdn1.iconfinder.com/data/icons/warnings-and-dangers/400/Warning-02-512.png);
}
<a class="my-link">My link</a>

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

How to properly adjust Margin and Padding in Bootstrap using Container and Columns

After spending hours using Bootstrap 4.1, I am struggling to align columns within a container. The margins and paddings are not cooperating: My goal is to create a 2x3 grid on large screens with items boxed and framed around them. However, there seems to ...

PHP contact form with AJAX functionality without page redirection

I'm currently working on a page that includes a contact form. The issue I'm facing is that when I click on "submit," the form redirects me to another page. What I actually want is for the page not to redirect, but instead display the success mes ...

Sending a POST request using HTML

Recently, I decided to create a URL Shrinker for fun and followed the Traversy Media tutorial to build it. If you're interested, here's the GitHub link to his project: https://github.com/bradtraversy/url_shortener_service As I aim to turn it in ...

Utilize local storage to dynamically update the background color of a div section

Struggling to create a functionality on my website where users can input a color, save it to localStorage, and have a specific div's background set to that color across all pages. The main content div (with the same ID) needs to display this color con ...

Requirement needed for the modal bootstrap to appear

Is there a way to prevent the modal from displaying and instead show another modal requiring me to fill in the "origin" or "destination" input fields if they are left blank when clicking the "Book" button? Currently, even if the inputs are empty, it stil ...

The synergy between HTML forms and Javascript

Is there a way to input a URL in a form and have it redirect to a different URL while keeping the original parameters? For example, if I enter , can it redirect to https://www.google.com/search?q=somequery? I believe this functionality can be achieved usi ...

Minimize all the open child windows from the main Parent window

I would like to implement a functionality where, upon logging in, the user is directed to a Main Page that opens in a new window. This Main Page contains two buttons, each of which will open a specific report associated with it in a new window when clicked ...

Is it possible to choose a concealed HTML radio button by using a designated label?

Attempting to work on a unique project here, creating an HTML calendar that allows users to select a day and submit the form without relying on javascript. Below is a snippet of the HTML code: <body> <form action="/Controller/Select" method=" ...

React ignores CSS rule

I am currently utilizing React to design some buttons and using CSS to style them accordingly. One of the classes I have created is called Button: export default class Button extends React.Component{ public className: string; constructor(props){ ...

Discover the neighboring characters of an element within a block of text

Recently, I encountered a unique challenge. My task involves identifying the first 3 characters before and after an anchor tag within a paragraph. For example: <p>This is <a href='#' id='lock'>a</a> test for an anch ...

The command to fix Eslint is not able to resolve all of the errors related to vue/html-indent

In my .eslintrc.js file, I have set up some linting rules as shown below: module.exports = { root: true, env: { browser: true, es6: true, node: true, }, extends: ['plugin:vue/recommended', 'eslint:recommended'], pa ...

Adjust the container width to match the width of the visible thumbnails?

Take a look at my website over at: . If you want to see more thumbnails, consider switching to a different album. The album titled Paris contains the most images. If you press the "Show Photo Grid" button located in the bottom-right corner, you'll be ...

Adding a simulated bottom border to a rotated container

Currently, I am utilizing the CSS3 rotate value to create an arrowhead effect for modal boxes. However, I now require a full arrowhead design with a bottom border. As this involves rotating a div at a 45° angle, adding another border to either side will n ...

Issues with JQuery in the Footer

Trying to achieve a footer that expands when moused-over using the following HTML/jQuery code below. However, the footer remains static and does not expand at all (see CSS at bottom). HTML: <div id="footer"> <div id="v_line"></div> ...

Can you trigger the playback of a sound file by clicking on a specific URL?

Can a sound file be played when clicking depending on the URL? For example: url/sample/#1 Click to play sound1 url/sample/#3 Click to play sound2 ...

Retrieve data from HTML Form arrays using JavaScript

I have a situation in my forms where arrays are being sent back in the following format: <input class="checkbox-service" name="services['electricity']" type="checkbox"> <input class="checkbox-service" name="services['water'] ...

Scrolling is disabled when using a full-screen background

My current issue involves a full screen background that is functioning properly when the window is resized, but it has caused a problem where scrolling is disabled when the page is longer than the window size. The content just gets cut off. Is there a way ...

HTML-PHP Once a user is authenticated and prior to logging out

Is it possible to change the label "login/register" in the vertical menu to display the username after a successful login? Below is my checklogin.php code: <?php define("DB_HOST","localhost"); define("DB_NAME","user_database"); define("DB_USER", ...

Trouble arises when adding HTML elements to a Content Editable Div. Any text inputted after programmatically inserting HTML content will merge with the last HTML tag instead

https://i.sstatic.net/bKIVm.pngI am currently working on a project that involves creating message templates within an app. Users have the ability to add placeholders for fields like names to these templates by clicking a button. They can also remove these ...

JQuery Mobile's Panel widget is the culprit behind the demise of the

I'm having some trouble adding a panel to my jQuery mobile page. Every time I try to input the code, all I see is a white screen with the loading widget, and nothing else happens. I have JQuery 2.0.0 hosted by Google, JQuery Mobile JS 1.3.1 hosted by ...