Maximizing Compatibility of CSS3 Responsive Image Sprites for Firefox

Take a look at the Demo. Make sure to test it on both Chrome and Firefox to experience the difference.

I've created a div element with the following CSS classes to make a responsive sprite of images:

.what-wwb-logo, .what-national-geographic-logo, .what-atm-logo, .what-us-ski-logo-large, .what-boart-logo,.what-comas, .what-left-arrow, .what-right-arrow{
     max-width: 100%; 
     background-size: 100%;
     background-image: url('/images/sprites/what_our_client_say_new.png'); 
}
.what-wwb-logo { 
     background-position: 0 0%;
     background-size: 100%;
     padding-bottom: 41%;
}
.what-national-geographic-logo {
     background-position: 0 16.588419%;
     background-size: 118.648019%;
     padding-bottom: 59%; 
     max-width: 77%;
}
.what-atm-logo { 
     background-position: 0 42.466823%; 
     background-size: 146.685879%;
     padding-bottom: 94%;
     max-width: 100%; 
}
.what-us-ski-logo-large { 
     background-position: 0 65.003723%;
     background-size: 181.785714%;
     padding-bottom: 65%;
     max-width: 70%;
 }
.what-boart-logo { 
     background-position: 0 84.194978%; 
     background-size: 200.393701%; 
     padding-bottom: 84%; 
     max-width: 84%; 
 }
.what-comas { 
     background-position: 0 92.206077%;
     background-size: 435.042735%;
     padding-bottom: 62%; 
     max-width: 80%; 
 }
.what-left-arrow { 
     background-position: 0 96.196003%;
     background-size: 820.967742%; 
     padding-bottom: 93%;
     min-width: 7px; 
 }
.what-right-arrow { 
     background-position: 0 100%;
     background-size: 820.967742%; 
     padding-bottom: 93%;
     min-width: 7px; 
 }

In my HTML code, I have included the following lines:

<div class="what-right-arrow " />
...
<div class="what-left-arrow " />
...
<div class="what-comas" />
...
<div class="what-boart-logo" /> //and so on for all div elements in different positions

Upon testing the code in Chrome, IE, and Firefox, everything worked fine except for Firefox.

The issue lies in the vibration of images (specifically what-right-arrow, what-left-arrow, and what-comma) which constantly oscillate up and down as well as left and right.

Could this be due to improper spriting or is it a problem specifically related to Firefox?

Answer №1

It appears that the issue with shaking images in Firefox may be related to a problem specific to that browser.

One potential solution seems to involve moving the background-image style onto individual selectors, which has been shown to stop the vibration: View Demo

For example:

// Causes vibration
.a, .b {background-image: url(example.png); background-size:50%;}

// Prevents vibration
.a, .b {background-size:50%;}
.a {background-image: url(example.png);}
.b {background-image: url(example.png);}

Similar issues have been encountered when resizing sprites in Firefox as well. By applying the background-image to each instruction separately, the problem can be resolved beyond just this demonstration.

There are reservations about resizing sprites for retina devices due to difficulties in maintaining precision across different browsers and devices. This includes concerns such as:

  • Experiencing vibrating bugs in Firefox and implementing necessary workarounds
  • Background-position values being slightly off, resulting in odd image cutoffs
  • The need to adjust all values by 50%, making it challenging to directly copy and paste code from sprite generators

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

I am trying to center align this image, but for some reason, it's not cooperating

Attempting to center the image using margin-left: auto and margin-right: auto properties in the code snippet above has proven unsuccessful. The image is not aligning as desired. What could be causing this issue with the code? Are there any other techniq ...

The justify-content: space-between property does not work in a nested flex box scenario

I'm currently working on styling a cart in Angular and facing an issue with aligning the price all the way to the right of the cart. I attempted using `space-between` within the outer div, which worked fine, but when applied to the inner div, it doesn ...

How can the seating arrangement be optimized for a seating chart and what is the most effective way to transition away from a traditional table structure?

Currently, I am attempting to create a dynamic seating chart on a webpage within an asp.net-mvc site using data retrieved from a database. Initially, I used a table to organize the grid layout of rows and columns, which resembled this structure: The datab ...

Upon rerender, React fails to refresh the style changes

I am encountering an issue with my React component where the visibility and position can be changed by the user. Currently, the visibility can be toggled by adding or removing a CSS class, while the position is adjusted through a function that updates the ...

How can I send a current variable through PHP?

I have a pressing deadline and I need some guidance before moving forward. Can someone please advise if what I'm attempting is feasible or if there's a quicker solution? I encountered some problems with an accordion menu, so as a temporary fix, ...

Convert your flexible designs into dynamic HTML with our Flex to HTML/A

Looking for a solution to transform Flex code into Html/Ajax code. Most of my Flex code includes datagrids, buttons, and text labels. ...

Having trouble displaying json data in an HTML file with d3.js

I am having trouble loading data from a json file into an HTML file and using D3 to visualize it. Even though the file loads correctly and is verified with a 200 status, the contents are interpreted as null. Below are the contents of the json file: [{"to ...

What causes the inconsistency in CSS Hover behavior?

Looking to devise a button in css and html that reveals another button below it by rotating on its lowermost axis when hovered over. Progress has been made here: http://codepen.io/machinarius/pen/BdtCb However, there seems to be an issue with the hover b ...

In a remarkable design with an array of buttons and an individual div assigned to each, a fascinating functionality unfolds. Whenever a

https://i.stack.imgur.com/emhsT.png When I click on the first "Respond" button, I want the adjacent text box to disappear. Currently, if I click on the first "Respond" button, both text boxes will disappear instead of just the first one. $('.comment ...

Guide on how to incorporate an external javascript file into an HTML button

I am currently working on an exercise through Udacity that involves creating an HTML form with JavaScript functions. The task is to input text into the form, submit it, and have it displayed on the webpage within a blue square. This exercise is designed to ...

How come my HTML form keeps refreshing instead of displaying an alert after submission, even though I've included onsubmit="return false"? Additionally, it seems to be throwing an error

Why is this basic HTML and JavaScript code not functioning properly? Instead of alerting once the form is submitted, it refreshes the page and throws an error. It has also been reported to sometimes throw a CORS error when using 'module' as scri ...

Modify the background color of an R chunk in a bookdown gitbook

Is there a method to eliminate the grey background color in order to display the colorful class? https://i.sstatic.net/l1Hhi.png https://i.sstatic.net/4aHMF.png ...

Tips for verifying that a file has not been selected in Croppie

Whenever I use croppie to crop images on my website, everything works fine when I select an image and upload it. But if I try to crop and upload without selecting an image, a black image gets uploaded instead. How can I validate if the file upload is empty ...

Utilizing CSS to create a repeating background image within a specified container

I'm currently working on setting up a container with a background image that repeats only when the contained div elements are long enough. However, I seem to be encountering issues getting the image to repeat properly within the #container code. This ...

Utilizing Google Script to extract information from Gmail emails and transfer it to Google Sheets

I am facing a challenge with extracting data from an email and inputting it into a Google Sheet. While most of my code is functioning properly, I'm struggling with the regex section due to lack of expertise in this area. Below is a snippet of the HTM ...

The function of the Angular ng-include form action for posting a URL appears to be malfunctioning

When a form post is included in a parent HTML using ng-include, it does not trigger the submission action. <div ng-include src="'form.html'"></div> The code in the form.html file is as follows: <form action="next/login" method = ...

"Ensuring Consistency: Addressing the Conflict between CSS and Font

I'm encountering a "mixed content" error on my website caused by one font being loaded via HTTP. The font is referenced in a CSS file like this: @font-face { font-family: 'fontXYZ'; src: url('../font/fontXYZ.eot'); src: url ...

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 ...

The CSS element is styled with a background color while maintaining a level of transparency

My menu structure is set up as follows: <nav id="main"> <ul id="nav-user"> <li class="user-name"> <span class="name">John Doe</span> <ul class="submenu"> <li>Pro ...

A CSS pseudo-class similar to :empty that disregards hidden children

Are you familiar with the :empty pseudo-class? This pseudo-class targets elements that have no children at all. But is there a way to target elements that have no visible children (excluding those with display: none)? If such a pseudo-class doesn't e ...