"Enhance your website with smooth transitions using CSS3 sprites

I am looking to create a smooth fade in and fade out effect for images within a CSS sprite. The code below currently applies transitions to all images, but I need assistance specifically with fading in and out the images within the CSS sprite.

HTML CODE

 <div class="navigation">
    <div class="navigation1 process-normal" id="process"></div>
  <div class="navigation1 works-normal" id="works"></div>
  <div class="navigation1 team-normal" id="team"></div>
  <div class="navigation1 products-normal" id="products"></div>
  <div class="navigation1 services-normal" id="services"></div>

CSS

.services-active, .products-active, .works-active,
.process-normal, .process-active, .products-normal, .team-normal, .team-active, 
.works-normal,.brain,.static,.services,.people,.servies-normal
 { display: block; background: url('allimages.png') no-repeat; }
.navigation1
{
-webkit-transition: all 1s ease;
-moz-transition: all 1s ease;
-o-transition: all 1s ease;
transition: all 1s ease;
}

Answer №1

For a detailed guide on achieving CSS transitions using image sprites, make sure to visit this informative website.

Take a look at the interactive DEMO (derived from the link above)

HTML

<a href="#" class="arrow">Arrow<span></span></a>

CSS

.arrow {
    display: inline-block;
    position: relative;
    text-indent: -9999px;
    width: 36px;
    height: 36px;
    background: url(sprites.png) no-repeat;
}

.arrow span {
    position: absolute;
    top: 0; left: 0; bottom: 0; right: 0;
    background: url(sprites.png) no-repeat;
    background-position: -50px 0;
    opacity: 0;
    -webkit-transition: opacity 0.5s;
    -moz-transition:    opacity 0.5s;
    -o-transition:      opacity 0.5s;
}

.arrow:active span {
    opacity: 1;
}

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

Is it possible for a Div's height to be equal to 100% of its container's

<div id="wrapper"> <div id="main-content"> //my main content </div> </div> #wrapper{ height:100%!important; min-height:700px!important; } #main-content{ height:100%!important; } Despite setting the height of my main ...

Are there any resources available to ensure my jQuery script is compatible with multiple browsers?

After realizing that Internet Explorer does not support certain selectors in jQuery, I began to question how to ensure my code will function properly during the writing process. As a Linux user, my testing options are limited to Chrome and Firefox. Is ther ...

Using Jquery to store input values from within <td> elements in an array

I'm trying to capture user input from a dynamically changing table with 2 columns. How can I retrieve the data from each column separately? The size of the table is adjusted by a slider that controls the number of rows. Below is the structure of my ta ...

A guide to sending a GET request with custom headers and adding parameters to the request

I recently came across information on the Google OAuth documentation about sending an OAuthGetRequestToken request using the Authorization header of a GET or POST request. The instructions are to include "Authorization: OAuth" in the header, with all param ...

Enhance Your Designs with CSS3 Animated Text in SVG Artifacts

I am noticing some glitches in text animations/scaling in various modern browsers including Chrome 29, IE10, Safari 5.1 (Windows), Safari 6.0.5 (Mac), and Opera 16. Surprisingly, Firefox (tested with version 23) seems to be working fine on Windows except f ...

Prevent event bubbling when clicking

I have a code snippet that I'm struggling with. <p>haha</p> <button class="btn btn-light" onclick="nextSibling.classList.toggle('d-none');"> <i class="fa fa-ellipsis-h"></i> </button> <div class= ...

Tips for organizing JSON data in AngularJS are as follows:

Can someone assist me in looping this array value into 3 columns using angularjs? Currently, my view appears as an HTML table with 3 columns, but the values are displayed vertically instead of horizontally. You can see an example of how it looks here. Bel ...

Please provide the jQuery function with the URL

<script type="text/javascript" src="http://code.jquery.com/jquery-1.7.2.min.js"></script> <script> function open(url) { $('#blockdiv').fadeIn(); $('#iframe').attr('src', url); $('#container ...

Firefox browser does not display flashing titles for tabs

Every second, I want to display "New message..." in the title when the browser tab is inactive or the user is in another tab. Here's the code I used: <script> var mytimer; function log() { document.title = document.title == "" ...

What is causing the navigation to disappear off the left side of the screen when the media query is activated?

When the screen size is less than 450px, the logo disappears in order to make room for navigation. However, the navigation then extends about 20px off the left side of the screen. View the code here This CSS code snippet appears to be relevant: @media s ...

Overlap elements without using absolute positioning and prevent resizing distortion

Looking to incorporate a line with tick marks and a ball (similar to a scale) into my design. Some tutorials recommend using absolute positioning or float for this effect. While these methods work partially, I've noticed that the divs tend to shift o ...

Locate elements using Class with Simple Selenium

I'm facing a challenge filling out a phone number on a web portal using Selenium with VBA. Despite the element being loaded, Selenium seems to be unable to locate the text box. This is my code: Dim ch As Selenium.ChromeDriver Sub FillPhoneNumbers() ...

Issue arising from CSS and div elements

I am facing some challenges in making certain divs behave as desired. Take a look at the following references: Link 1: - contains two divs Link 2: - has only one div I am trying to utilize two divs (.content) without them being positioned incorrectly ...

Start flicker issue in Vue 3 transition

I have created a carousel of divs that slide in and out of view on the screen. However, I am facing an issue where during the start of each transition, when a new div is rendered (i.e., the value of carousel_2 changes), it appears without the transition-en ...

Does the presence of the < script > tag in HTML impact the output of the HTML in a browser?

Can someone help troubleshoot this code? <!doctype html> <html lang="en"> <head> <title>Example</title> <link type="text/css" rel="stylesheet" href="tjg.css"/> </head> <body> <script ...

Refine your search by focusing on select characteristics of an item

Is there a way to filter tasks in a table using only specific attributes provided in the table? Currently, when I enter a search term in the search bar, tasks are displayed even if they have attributes that match the input but are not displayed in the na ...

Guide to efficiently utilizing flex to horizontally position two elements next to each other in a Material UI and ReactJS environment

I have successfully achieved side-by-side components of two cards from Material-UI. However, I am facing an issue when expanding one of the cards. The problem is that Card 1 automatically expands to match the size of Card 2 when Card 2 is expanded, even th ...

What disparities exist between utilizing Arial Black font and regular Arial font with the <Strong> tag?

Despite setting my text to Arial Black, it appears as regular text on Firefox. To workaround this issue, I tried using the Arial font with the Strong tag but couldn't notice any visual difference. Should I be concerned about this discrepancy? Thank y ...

Uncertainty lingers over the location of where a JQuery javascript function is invoked in this particular code snippet

Hey there, I'm new to JavaScript and have a question about this demo website: The homepage header features a SlideShow created using a JQuery plugin called FlexSlider. The HTML section for this is as follows: <!-- Slider Section with Flexslid ...

Administering changes to JSON data files through PHP

I am currently working on a code that creates a JSON file on the server to save form data. However, I have encountered an issue where every time the submit button is clicked, the form data appends to the existing data in the JSON file instead of updating i ...