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

  • Home
  • SEARCH
  • 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 6880735
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T05:00:43+00:00 2026-05-27T05:00:43+00:00

Ok, so I have an empty <span> that is nested in side my <li>

  • 0

Ok, so I have an empty <span> that is nested in side my <li>‘s of an unordered list. The span holds a background image that is supposed to appear on :hover. The problem is that while the animation is transitioning, the z-index is wrong, the <span> stacks itself in front of the <a> element which precedes it in the DOM. As soon as the animation completes, however, the stacking order corrects itself. The result is a visual sudden “snap” of the effect and also the link becomes unclickable for the duration of the CSS3 transition.

Can anyone break down what is happening at the DOM level? How can I fix this?

You can see a working example that demonstrates the issue here: http://jsfiddle.net/qZkfw/1/

My HTML

        <div id="nav">
          <ul id="nav-main">
            <li><a href="#">Home</a><span></span></li>
            <li><a href="#">About</a><span></span></li>
            <li><a href="#">Get Fit</a><span></span>
                <ul class="nav-secondary">
                  <li><a href="#">Exercise Library</a></li>
                  <li><a href="#">Find An Instructor</a></li>
                  <li><a href="#">Fitness Tools</a></li>
                </ul>
            </li>
            <li><a href="#">Find An Instructor</a><span></span></li>
            <li><a href="#">Get Certified</a><span></span></li>
          </ul>
        </div>

my CSS

#nav-main li {
    margin:0;
    padding:5px;
    position: relative;
    display: block;
    float: left;
    margin-left: 10px;
}

#nav-main li a {
    color: #97dd6e;
    font-size: 1.1em;
    text-decoration: none;
    text-align: center;
    margin-right: -7px;
    line-height: 19px;
    z-index: 99;
}

#nav-main li span {
    height: 28px;
    background: transparent url('/images/application/bg_nav_active_repeat.png') repeat-x top center;
    display: block;
    margin: -22px -5px 0 2px;
    padding: 3px 0 0 0;
    z-index: 98;

    opacity: 0;
    visibility: hidden;     
    -webkit-transition: all 0.2s ease-in-out;
    -moz-transition: all 0.2s ease-in-out;
    -o-transition: all 0.2s ease-in-out;
    transition: all 0.2s ease-in-out;   
}
#nav-main li:hover span {
    opacity: 1;
    visibility: visible;
    -webkit-transition: all 0.4s ease-in-out;
    -moz-transition: all 0.4s ease-in-out;
    -o-transition: all 0.4s ease-in-out;
    transition: all 0.4s ease-in-out;   

}
#nav-main li span:before, #nav-main li span:after {
    content: '';
    height: 28px;
    width: 7px;
    display: block;
    background: transparent url('/images/application/bg_nav_active_before.png') no-repeat left top;
    position: absolute;
    top: 2px;
    left: 0;
    z-index: 999;
}
#nav-main li span:after {
    background: transparent url('/images/application/bg_nav_active_after.png') no-repeat right top;
    left: 100%;
}
  • 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-27T05:00:44+00:00Added an answer on May 27, 2026 at 5:00 am

    Add position:relative; z-index: -1; to #nav-main li span.

    Updated jsfiddle.

    Edit:

    I figured it out.

    Static elements do not obey z-index, so you need to add position:relative; to #nav-main li a.

    Updated jsfiddle.

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

Sidebar

Related Questions

I have the following.. <span class=error>@Model.ErrorMessage</span> The problem is that the css for error
I have files which have many empty cells which appear as NaNs when I
If I have an empty tag: <tag/> How can I add text so that
I have a link that calls: <a href=/coupons/print_coupon/<?php echo $coupon['id']; } ?> id=print><span style=margin-left:24px;>Print</span></a>
I have a string that looks like: >ANY CONTENT</span>(<a id=show I need to fetch
I have an ASP.NET page that uses a repeater nested within another repeater to
I have: if(isset($_POST['submit'])) { if (empty($name)) { echo'<span class=error>ERROR: Missing Name </span><br/>'; } else
I have a list of words that I'd like to add a link to,
I have a form that manipulates the size of an image that is posted
the empty selector says that: Matches all elements that have no children (including text

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.