Image in the background not showing up on Chrome or Internet Explorer

The issue I'm facing is that the background-image displays correctly in Firefox, but not in Chrome or IE. Despite trying various solutions found on Stackoverflow, such as disabling my ad-blocker, placing the code in the head of the file:

<head><style>...</style><head>

or in the style attribute of the link:

<a style="..."> ... </a>

I've ensured there are no elements affected by the appearance attribute, experimented with adding the background-attachment: fixed; style, and even attempted to adjust the position coordinates:

background-position-y: 465px;
background-position-x: 5px;

to:

background-position: left center;

All these variations work flawlessly in Firefox with the following CSS:

.search-btn {
        padding-left: 32px;
        padding-right: 10px;
        background-image: url(../Images/search.png);
        background-position-y: 465px;
        background-position-x: 5px;
        background-repeat: no-repeat;
    }

But they fail to render properly in Chrome or Internet Explorer.

<asp:LinkButton ID="btnSearch" runat="server" CssClass="btn blue-btn mar-bot search-btn" OnClick="btnSearch_Click">Search</asp:LinkButton>

The other classes listed in the CssClass attribute follow the order in which they appear in my CSS stylesheet:

.mar-bot {
    margin-bottom: 6px;
}

.blue-btn {
  background-color: #55acee;
  box-shadow: 0px 5px 0px 0px #3C93D5;
}

.blue-btn:hover {
  background-color: #6FC6FF;
}

.btn {
  border-radius: 5px;
  padding: 4px 8px;
  text-decoration: none;
  color: #fff;
  position: relative;
  display: inline-block;
}

.btn:active {
  transform: translate(0px, 5px);
  -webkit-transform: translate(0px, 5px);
  box-shadow: 0px 1px 0px 0px;
}

.search-btn {
...
}

Answer №1

.search-btn {
            padding-left: 32px;
            padding-right: 10px;
            background-image: url(../Images/search.png);
            background-position: left center;
            background-repeat: no-repeat;
            display: inline-block;
        }

It is interesting that the code requires display: inline-block; to function properly.
Although I'm not sure why, it definitely does the trick.

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

Does the CSS overflow property affect the borders of an element?

Consider a situation where a "div" element has a border applied to it. When the overflow rule is set to 'hidden', any content that falls directly on the border will vanish. Is there a solution for this issue? It is crucial in my case to ensure t ...

How to manage print preview feature in Firefox with the help of Selenium in the Robot Framework

Attempting to select the 'cancel' button in the print preview page on Firefox has proven to be a challenge. Despite my efforts, I am unable to access the element by right-clicking on the cancel option. Interestingly, Chrome allowed me to inspect ...

ReactJS creating trouble with incorporation of CSS in Table

I've noticed some strange behavior with the alignment of my table data. It seems to be all over the place. How can I fix this issue? Is there a way to specify column widths and ensure the text starts from the same position? Take a look at the table b ...

Center and align pictures within a stationary container

I am working on a simple webpage that has a fixed footer. In this footer, I want to have 5 images centered with equal distances between them. Below is my HTML/CSS : Footer div : div.fixed { position: fixed; bottom: 0; right: 0; width: ...

`Unable to activate Bootstrap dropdown feature`

Having an issue with the dropdown menu on my Bootstrap navbar - when I click it, nothing happens. I've tried various solutions found online, such as moving the <script type="text/javascript" src="js/jquery-3.3.1.min"></script> file to the ...

What is the best way to insert a block of text above a slideshow without causing it to move downwards?

I've successfully integrated a slideshow within a section tag using a div tag. To include text above the slideshow, I placed another div tag above the slideshow div. However, when adding more text, it causes the images in the slideshow to get pushed d ...

How can one element be made to rely on the presence of another element?

I'm currently working on my portfolio website and encountering an issue. Whenever I hover over an image of a project, the image expands in size, becomes less transparent, and a description of the project pops up. However, I would like to include a lin ...

Tips for preventing exceptions from being raised by .Net's HttpWebRequest.GetResponse()

Is there a way to customize the .Net HttpWebRequest object to prevent it from throwing an exception when calling HttpWebRequest.GetResponse() and receiving any 300 or 400 status codes? Despite Jon Skeet's doubts, I can't help but wonder if there ...

Extract the image URL from the href attribute using Xpath

My goal is to extract all images enclosed in href attributes from the given code snippet <div class="jcarousel product-imagethumb-alt" data-jcarousel="true"> <ul> <li> <a href="https://domain/imagefull.jpg" onclick="return false;" cla ...

Dynamically generate an instance type by utilizing the assembly name and class name

Is it possible to dynamically create an instance of an interface object using the Activator class? Here is an example class that implements the interface: namespace ReportService.ReportWriters { class ExcelWriter : IReportWriter { ...

Utilizing Bootstrap to display side by side images at full height

Can someone help me achieve the layout shown in the image below? I want a container that spans full width and height with 2 images and other elements inside. The images should be full-height within the container, but also automatically adjust their width t ...

Update CSS using onChange event with an array of values

I'm currently working on an app that allows users to select a color scheme from a dropdown form. The hexidecimal values associated with the selected color scheme successfully populate specific text fields as intended. However, I am facing difficulty i ...

How can you utilize positioning and margins with Flexboxes?

<template> <div class="flex justify-center"> <div class="h-px-500 md:w-1/6 bg-orange-200 text-center">1</div> <div class="h-px-500 md:w-1/6 bg-orange-300 text-center">2</div> <div class="h-px-500 md:w-1/ ...

Issue with jQuery Quicksand's CSS rendering in Internet Explorer and Firefox browsers, but not affecting Chrome

I'm attempting to achieve an icon-swapping effect using jQuery+quicksand. Although it works seamlessly in Chrome, I am encountering issues with IE and Firefox. Given that the more intricate quicksand demos function flawlessly across all browsers, I su ...

What causes Selenium ITakeScreenshot to capture a black screen from an IE window?

While working with a Class Library.dll that contains SpecFlow tests written in C# / Selenium, I encountered an issue where using the standard code to capture a screenshot resulted in just a black window. This was puzzling as previous builds and .dll files ...

Tips for optimizing Jquery selectors to streamline recurring functions

I have 9 "service node" divs in my HTML code, each containing a hidden div and a button that triggers the rotation of the button by 45 degrees and reveals the hidden div. The challenge I am facing is that I have been using repetitive functions for each ser ...

Executing a JavaScript function through C# code

Does anyone have a code snippet for calling a JavaScript function from C#? Here's the scenario: I have an ASP.NET page with an ASP button. When this button is clicked, I want to call a JavaScript function. For example: In my ASP.NET page, <but ...

React's struggle with implementing flexbox functionality

Struggling to implement a calculator using React and flexbox, but running into issues with my flexbox layout. I've attempted to troubleshoot using the Chrome Dev Tools but haven't made any progress. import React, { Component } from "react"; imp ...

Having trouble rendering components due to conflicts between React Router and Semantic UI React

Below is the code in my App.js: import { useRecoilValue } from 'recoil'; import { authState } from './atoms/authAtom'; import { ToastContainer } from 'react-toastify'; import { ProtectedRoute } from './layout/ProtectedRou ...

ReactJS how to prevent accordion from collapsing automatically

My custom accordion layout for the features needed in the site I am building is not working well with Jquery. How can I modify it to collapse properly? Specifically, I want it so that when I open number 2, number 1 will automatically close. I've trie ...