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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T13:00:55+00:00 2026-05-27T13:00:55+00:00

I am having an issue with overlapping items within a floating div. I must

  • 0

I am having an issue with overlapping items within a floating div. I must be applying the z-index wrong, but I’ve tried a few different things and I can’t get the two items to overlap. I have the following code (note: topLink and topIconNew divs are actually pngs):

http://jsfiddle.net/jhacks/neskB/7/

HTML:

<div class="topIcon">          

<div class="topIconNew"></div>
<div class="topLink"></div>

</div>  

CSS:

.topIcon{

border:1px solid black;
background-color:gray;
width:28px;
height:40px;
float:right;
position:relative;
}

.topLink{
background-color:green;
width:16px;
height:16px;
position:absolute;
    top:14px;
    left:6px;
    z-index;300;
 }    

.topIconNew{
background-color:red;
margin:30px 0px 0px 18px;
width:10px;
height:10px;
position:relative;
    z-index:350;
cursor:pointer;
}

The HTML for the pngs (if it makes a difference):

<a href="xxxxx.html"><img src="xxxxx.png"> </img> </a>

EDIT** I’ve done it! Finally. Thank you for the help… upon seeing your code I saw the use of absolute and relative together. I now have a better understanding over the usage of those things and now instead of positioning things with padding/margins, I’m using (and correctly so I’d assume) positioning. I feel stupid for doing what I was doing.

  • 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-27T13:00:56+00:00Added an answer on May 27, 2026 at 1:00 pm

    Thanks for the edits, your question is much more clear now. I think this will satisfy your question.

    http://jsfiddle.net/neskB/26/

    Okay, so this makes a lot more sense now.

    1. You have gray div floated right
    2. You want to center a green div in this
    3. You want a red div in bottom right of green div

    First I would change your html structure to this.

    <div class="topIcon">                 
        <div class="topLink">
            <div class="topIconNew"></div>
        </div>                    
    </div>  
    

    Link will be positioned relative to its parent Icon.
    New will be positioned relative to its parent, Link.

    /* set topIcon to relative so that its child will be positioned relative to it */
    .topIcon{     position: relative;   }
    
    /* topLink is absolute positioned. We use top/left of 50% and negative margins to automatically center it */
    .topLink{
        position: absolute;
        width:16px;
        height:16px;
        margin:-8px 0 0 -8px;
        left:50%;
        top:50%; 
    }
    
    /* New is positioned in bottom right of its parent */
    .topIconNew{
        position:absolute;
        bottom:0px;
        right:0px;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Having an issue here that I have tried everything I can think of but
I have a primefaces dataList within a primefaces dataGrid but I'm having issue mapping
I'm having an issue with a Flash/Flex erroring in Firefox but not IE. I
I'm having issue converting this string to a decimal. I tried to follow the
Having an issue applying the rules that rounders the upper-left and upper-right corners in
I am having issue with Google line chart API. When I reload the div,
I am having issue passing get variables. index?p=calendar refers to calendar.php located in pages/calendar.php
I am having issue in compiling code having templated classes nested within other templated
I am having issue with png image on IE6 and tried to search every
I am having issue with my js function within a ADF Faces af:interator .

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.