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 8337917
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T04:25:56+00:00 2026-06-09T04:25:56+00:00

I am having trouble with element stacking in a HTML page. I need to

  • 0

I am having trouble with element stacking in a HTML page. I need to get span (class=“class_span”) to have a higher stacking order than div (class=“class_div”) with border. I have tried to change the z-index but with no luck. I know that I should not use absolute position, but the page is dependent on it, sorry. How can I accomplish this?

HTML:

<ul>
    <li>
        <div class="class_div">
        </div>
        <span class="class_span">
            <a href="google.com">google</a>
        </span>
    </li>
</ul>​

CSS:

.class_div{
    position: absolute; 
    border: 100px solid; 
    width:100px;
    height:50px;
    left:0px;
}
.class_span{
    float: left;
}​

Live DEMO

  • 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-06-09T04:25:58+00:00Added an answer on June 9, 2026 at 4:25 am

    Add position: relative to the span so that you can apply z-index on it. Note that the z-index of your span must be higher than that of the div so that it appears above the div:

    .class_div{
        position: absolute; 
        border: 100px solid; 
        width:100px;
        height:50px;
        left:0px;
        z-index: 1;
    }
    .class_span{
        float: left;
        position: relative;
        z-index: 10;
    }​
    

    Example

    Edit:

    As an alternative to float: left, you might consider using position: absolute and set left to 0px:

    .class_span{
        position: absolute;
        left: 0;
        z-index: 10;
    }​
    

    You may need to set the top as well, and it may also be necessary to set a parent element’s position to relative so that the span can be positioned relative to that parent element.

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

Sidebar

Related Questions

I having trouble to select the currently clicked container element. My Html <div class=cparent>
I'm having some trouble using the Element.getElementsByTagName method. With the following HTML: <p id=test>
I am having trouble accessing the value of an HTML Input element using jQuery,
I am having trouble accessing both the Class and the current element. How can
I having trouble in dividing the HTML frames. I have been using the following
I am having trouble using JQuery with ASP.net. I have a HTML img ,
I'm having trouble copying an element in my page DOM. Here's the code of
I am having trouble checking checkboxes via JQuery - I have done this: if(element[1]==3)
I am having trouble figuring out one implementation problem, I have one class, it
I'm having trouble trying to override a form element's onsubmit event. I have no

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.