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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T23:55:06+00:00 2026-06-15T23:55:06+00:00

I have a div with absolute position on a page which overlaps on another

  • 0

I have a div with absolute position on a page which overlaps on another div when scrolling. I want to make it invisible when it scrolls to a specific div.

For that purpose, I’m using the z-index. I’m setting the z-index 1 of the div which I want to hide, and much higher z-index for the other div. However it does not hide the div. If I set the z-index to -1 then it hides but then the links on that div are no more clickable. How can I fix this?

.wrap {
  width: 300px;
  position: relative;
  overflow: hidden;
  border: 1px solid #000;
}

.up {
  height: 100px;
}

.box {
  position: absolute;
  top: 20px;
  background: yellow;
  width: 100px;
  height: 100px;
  z-index: -1;
}

.down {
  background: green;
  overflow: hidden;
  z-index: 200;
  height: 400px;
}
<div class="wrap">
  <div class="up">
    <div class="box"><a href="#">Should hide</a></div>
  </div>
  <div class="down">Should be visible</div>
</div>

So the problem in above example is that the links in the .box are not clickable (because of -ve z-index value), and if I set it positive, it wont hide behind the .down.

JSFiddle:
http://jsfiddle.net/G2xRA/

  • 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-15T23:55:07+00:00Added an answer on June 15, 2026 at 11:55 pm

    Actually z-index only works with position so I gave the position:relative; to your .down class.

    See the mentioned below CSS & DEMO.

    .box{
            position: absolute;
            top: 20px;
            background: yellow;
            width: 100px;
            height: 100px;
            z-index: 1;  
        }
    
        .down {
            background: none repeat scroll 0 0 green;
            height: 400px;
            overflow: hidden;
            position: relative;
            z-index: 2;
        }
    

    DEMO

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

Sidebar

Related Questions

I have this JSF page: <div id=settingsdiv style=width:350px; height:400px; position:absolute; background-color:r; top:20px; left:1px> <h:form>
I have a div that is position: absolute and it contains items that get
i have a container div which is position:relative and the squares are position:absolute because
I have an html page which contains a div that displays the html from
I have a div which I have set to absolute position and z-index above
I have a Div layer like this ... <style type=text/css> <!-- #newImg { position:absolute;
I have a <div> element with position: absolute and z-index something big. I would
I have following HTML: <div class=olympics style=display: block; position: absolute; left: 250px; top: px;>
I have something like this currently: <div class = className style = position: absolute;
I have 2 divs A & B. div A has a position absolute to

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.