Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7657863
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T13:07:07+00:00 2026-05-31T13:07:07+00:00

I have a list on my website and the <li> background is a 1

  • 0

I have a list on my website and the <li> background is a 1 pixel black color image of 30% opacity which repeats to fill the whole <li>. It has a hover, which is a 1 pixel white color image of 2% opacity.

Instead of an instant appearance of the hover background, I want the hover background to smoothly fade in (and out).

HTML

<ul>
    </i>Lorem ipsum dolor sit amet, consectetur adipisicing elit. 1</li>
    </i>Lorem ipsum dolor sit amet, consectetur adipisicing elit. 2</li>
    </i>Lorem ipsum dolor sit amet, consectetur adipisicing elit. 3</li>
</ul>

CSS

li{
    width: 572px;
    height: 20px;
    padding: 4px 14px 0px 14px;
    background: url('../images/black_op30.png');
    border-bottom: 1px solid #2f2f2f;
}

li:hover{
    background: url('../images/white_op2.png') repeat;
}

I think what I want can be achieved with jQuery, but I have no clue how.

EDIT: Simple said, what I want is just to make the hover of the <li>s transition smoothly.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T13:07:09+00:00Added an answer on May 31, 2026 at 1:07 pm

    You can do this most easily with css3 transitions like this:

    li{
        width: 572px;
        height: 20px;
        padding: 4px 14px 0px 14px;
        background: url('../images/black_op30.png');
        background: rgba(0,0,0,0.3);
        border-bottom: 1px solid #2f2f2f;
        -moz-transition: background 1s;
        -webkit-transition: background 1s;
        -o-transition: background 1s;
        -ms-transition: background 1s;
        transition: background 1s;
    }
    
    li:hover{
        background: url('../images/white_op2.png') repeat;
        background: rgba(255,255,255,0.02);
    }
    

    Note the transition is occurring between the to rgba versions of your transparent colors. You can achieve the same thing with jQuery, but its much more complicated and will not animate as smoothly. Also fading between transparent colors and rbga is not possible in IE, and with this technique IE will work fine and just wont fade (it falls back to your .png files where rgba is not supported).

    IE supported method, (brace yourself):

     <li id="wrap">
         <div id="content">
              Content
         </div>
         <div id="fade-1"></div>
         <div id="fade-2"></div>
     </li>
    

    CSS

    #content, #fade-1, #fade-2{
        width: 572px;
        height: 20px;
        padding: 4px 14px 0px 14px;       
        position: absolute;
    }
    
    #content{
        z-index: 3;
    }
    
    #wrap{
       position:relative;  
       width: 600px;
       height: 24px;
    }
    
    #fade-1{
       background: url('../images/black_op30.png');
       background:transparent url(../images/black_op30.png);filter:progid:DXImageTransform.Microsoft.AlphaImageLoader»(src='../images/black_op30.png',sizingMethod='scale');
       background: rgba(0,0,0,0.3);     
       border-bottom: 1px solid #2f2f2f;   
       z-index: 1;    
    }
    #fade-2{
       display:none;
       background: url('../images/white_op2.png') repeat;
       background:transparent url(../images/white_op2.png);filter:progid:DXImageTransform.Microsoft.AlphaImageLoader»(src='../images/white_op2.png',sizingMethod='scale');
       background: rgba(255,255,255,0.02);
       border-bottom: 1px solid #2f2f2f;
       z-index: 2;
    }
    

    JS:

    $('#wrap').hover(function(){
         $('#fade-1').stop().fadeOut();
         $('#fade-2').stop().fadeIn();
    }, function(){
         $('#fade-1').stop().fadeIn();
         $('#fade-2').stop().fadeOut();
    });
    

    http://www.webmasterworld.com/forum83/7828.htm
    http://api.jquery.com/hover/
    http://api.jquery.com/stop/
    http://api.jquery.com/fadeOut/
    http://api.jquery.com/fadeIn/

    However this method will still yield worse results than the CSS3 method in all other browsers, so ideally you would use both and control the HTML, CSS and JS with an if statement to detect IE. Additionally IE9 does support rgba but not transitions, so for a best of all worlds scenario, you would have the IE version for ie6-8, a version using the jQuery color plugin:

    http://www.bitstorm.org/jquery/color-animation/

    for IE9 and the simple CSS3 for all other browsers.

    OR you could say, ‘hey cross fades are not that important to my design, its ok if those who have not updated their browser miss out.’ Which is strongly what I would recommend.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a website that has products list page and product detail page .
I would like to have a list of browsers which don't support a website
I have a list of items that are created from the results of website
Okay, so here's my problem: I have a list of members on a website,
I have a website that contains a list of articles. I want to include
I currently have profiles on my website with a unordered list for the navigation,
Need a list of Pcap.Net members or classes? Their website doesn't have much documentation
I am working on a website, I have a page containing a list of
I have got a list of menus up on our website with the current
Background I have a ror application which is continuously recording and showing on a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.