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

The gap separating the three columns in the DIVs structure

Here is an example that I need The images are being loaded from a MySQL while loop, and I want the spacing between them to be such that the left column and right column touch each side with the middle image centered. Just like in the picture :D This is m ...

Components will be displayed without any gaps on smaller screens

I attempted to apply styles to two components in order to create space between them, visible on both larger and smaller displays. The code snippet appears as follows: <div> <CustomPageHeader pageTitle={t('offersPage.pageHeader')} ...

Conceal the initial element featuring an image

Given that the post-body includes various elements, such as links and divs, I am interested in concealing only the first child element that contains an image. <div class="post-body"> <div class="separator"><img/></div> </div&g ...

Unable to view numbers on iPhone or ios device

I am facing an issue with displaying a phone number in the contact section on my website. The number shows up on desktop but not on my iPhone, even when I resize the screen to be smaller than my phone's display size. This issue has been tested on both ...

Dynamic Website (Link Relationships / Responsive Design / Content Rendering with CSS and HTML)

Hello everyone! My name is Mauro Cordeiro, and I come from Brazil. I am just diving into the world of coding and have been following various tutorials. Stack Overflow has been an invaluable resource for me in my learning journey! Aside from coding, I am a ...

Mysterious gap found between image and table

Hey there! I've been struggling with an unusual gap between a top image and a table on my website (www.tradecaptaincoaching.com). The table was created using . Despite spending hours on it, I can't seem to get rid of the huge 200 pixel gap that& ...

SVG padding will only take effect if two or more sides are specified

What is the reason behind an SVG requiring at least 2 areas to be padded for padding to apply? For instance, applying padding-top: 50px to an svg element will have no effect. However, adding padding-top: 50px; padding-left: 1px will result in the padding ...

Add the output of an SQL query to an HTML table using Powershell

I have multiple databases from various SQL Servers. I am attempting to output SQL data to an HTML table using Powershell from these different databases/SQL Servers, and then send it via email. Although my current script is functioning, it generates multip ...

What is the best way to display the output after retrieving an array?

Database : --> product table P_id P_name P_uploadKey 1 Cemera 7365 2 Notebook 7222 3 Monitor 7355 4 Printer 7242 --> buy table B_id P_id B_nam ...

Switching between various quantities of inputs in each row using Bootstrap V3

My Bootstrap V3 form has a mix of rows with two inputs and rows with one input, as per the designer's request. Check out my fiddle here: https://jsfiddle.net/06qk4wh4/ <div class="form-group col-sm-12"> <label class="control-label col- ...

What is the best way to automatically convert the 'echo' function of PHP from HTML code?

I am looking for an easy way to convert PHP 'echo' code from HTML. For instance, similar to this tool: This particular tool converts JS printing code from HTML. In summary, I wish to see the following conversion: from <div id="foo"> ...

Design a background image that is optimized for both high-resolution retina displays and standard non-ret

Scenario I am working on a web page where I want the background image to be fixed, covering the entire screen or window (excluding tablets and smartphones). The background image has been created using ImageShack. Everything is running smoothly so far. T ...

Creating a dynamic trio of graphs with HTML5, CSS3, and Vanilla JavaScript

I successfully created a tree graph using HTML5 and CSS3, but currently the nodes are static. I am looking to enhance the graph by making it dynamic. By dynamic, I mean that if the number of nodes increases or there are multiple children added, the graph ...

Horizontal expanding and collapsing navigation menu

Is there a way to modify the expand menu bar so it expands from left to right or right to left, instead of top down? Any assistance would be greatly appreciated. Existing Expand Menu Bar <HTML> <HEAD> <META http-equiv="Content-Type" c ...

What is causing the failure of these "span" elements within an "a" tag in IE7?

Here is a code snippet that I am working with: HTML (version 4.0) <div class="temperatura"> <a href="/link/" class="temperatura_localita"> <span style="padding-left:12px;"> T ...

Troubleshooting: Vue.js Component template not displaying items with v-for loop

I recently implemented a method that calls an AJAX request to my API and the response that it returns is being assigned to an array. In the template section, I am using the v-for directive to display the data. Surprisingly, it only renders once after I mak ...

Two separate tables displaying unique AJAX JSON response datasets

As a beginner in javascript, I am facing a challenge. I want to fetch JSON responses from 2 separate AJAX requests and create 2 different tables. Currently, I have successfully achieved this for one JSON response and table. In my HTML, I have the followi ...

HTML tends to disregard the dimensions specified in the JavaScript file

I'm currently working on replicating an Etch-a-Sketch style drawing board where hovering over a single pixel with the mouse changes its color. However, I've hit a roadblock when it comes to drawing the board. The flexbox container doesn't se ...

"Exploring the versatility of using variables in jquery's .css

I’m facing an issue where I need the rotation of a div to be based on the value stored in "anVar." This is what I currently have: function something() { $('.class').css('-webkit-transform:rotate('anVar'deg)') } The desi ...

Why is a question mark added to the URL when the login button is clicked

I've encountered an issue where clicking this code for the first time redirects me to localhost:8080//? instead of localhost:8080//admin.html. Any idea why this is happening? $("#admin-login").click(function(){ var data = {"username": $("#admin ...