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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T09:34:15+00:00 2026-06-14T09:34:15+00:00

i’ve been going over this one for about two days. example it’s a fairly

  • 0

i’ve been going over this one for about two days.

example

it’s a fairly complicated design, so to reduce code pasted here i’ve recreated the main structure on this jsfiddle and included the simplified code at the end of this post:

http://jsfiddle.net/rwone/zwxpG/10/

scenario

i have a container with numerous <li>‘s containing a div (containing dynamic content from a database) that initially has the property display: none.

on hovering over an image in these <li>‘s however, i wish to show the div.

it is working, however the div appears to be beneath other elements in the container which has a fixed height and overflow-y: auto.

what i’ve tried

i have tried combinations of z-index’s and absolute and relative positioning, but i haven’t been able to find a solution yet.

i’ve isolated two causes in the code below and the jsfiddle (shown as /* comments */) but these do not work on the live test site.

question

my question is therefore, is there another way to enforce that the hover state div is shown on top of and outside of the container that is enclosing it?

it is not an ideal solution that i can fix these issues in the jsfiddle but not the live site, but i just thought i’d ask if there was another way to approach this altogether?

thank you.

html

<div id="wrapper">
<div id ="hbar_one"></div>
<div id="hbar_two"></div>
<div id="container_a">
<div  id="container_b">
<ul>
<li>
hover me #1
<div id="container_c">
Lorem ipsum dolor sit amet, consectetur adipiscing elit. In fringilla porttitor ante ut varius. Fusce volutpat velit ut orci porttitor cursus. Donec est eros, tempor ac elementum et, volutpat sit amet lorem. Mauris iaculis eros nec sapien hendrerit at sodales nibh iaculis. Morbi imperdiet porta est vitae suscipit. Curabitur sit amet diam in nulla consectetur placerat. Etiam in sapien ac mi scelerisque congue eu id lectus. Proin fermentum auctor turpis vel adipiscing. Maecenas at convallis sapien.
</div>
</li>
<li>
hover me #2
<div id="container_c">
Lorem ipsum dolor sit amet, consectetur adipiscing elit. In fringilla porttitor ante ut varius. Fusce volutpat velit ut orci porttitor cursus. Donec est eros, tempor ac elementum et, volutpat sit amet lorem. Mauris iaculis eros nec sapien hendrerit at sodales nibh iaculis. Morbi imperdiet porta est vitae suscipit. Curabitur sit amet diam in nulla consectetur placerat. Etiam in sapien ac mi scelerisque congue eu id lectus. Proin fermentum auctor turpis vel adipiscing. Maecenas at convallis sapien.
</div>
</li>
</ul>
</div>
</div>
<div id="hbar_three"></div>
<div id="hbar_four"></div>
</div>

css

#wrapper {
 width: 300px;   
}
#hbar_one {
 background: #cc0000;   
 height: 50px;
}

#hbar_two {
 background: #ffcc00;   
 height: 50px;
}

#container_b {
    height: 50px;
/* cause one - on its own, this causes the undesired 'underneath' effect */
    overflow-y: auto;
}

ul li {
    display: inline;
/* cause two - on its own, this causes the undesired 'underneath' effect */
    position: relative;   
}

#container_c {
    display: none;
}

ul li:hover #container_c {
 background: #00AFF0;
 display: block;
 width: 200px;
 height: 200px;
 position:absolute;
 top: -20px;
 left: 50px; 
 z-index: 999;  
overflow: hidden;    
}

#hbar_three {
 background: #cccccc;   
 height: 50px;
}

#hbar_four {
 background: #000000;   
 height: 50px;
}

update

in response to answer below, here is further information on the actual content that is being displayed upon hover (everything within the #container_c div). each <li> has its own unique content:

​<li class=".class1 .class2">
<img src="http://path/to/image.jpg">
<div id="container_c">
<h4>title</h4>
<div id="container_c_left">
<span id="cl1">text</span>
<span id="cl2">text</span>
<span id="cl3">text</span>
</div>
<div id="container_c_right">
<span id="cr1">text</span>
<span id="cr2">text</span>
</div>
<span id="cc1">text</span>
<span id="cc2"><a class= "linkclass" href="http://path/to/link.html">link</a></span>
</div>
</li>
  • 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-14T09:34:16+00:00Added an answer on June 14, 2026 at 9:34 am

    the solution was a mixture of @NoPyGod’s jquery suggestion and to have a better understanding of how absolute and relative positioning work.

    basically, when absolute and relative positioning are applied to a div, this position is relative to the position of the last element that had absolute or relative positioning defined and is a ‘container’ of the div you are working with.

    to escape from the ‘container’ that had overflow: auto and a fixed height and width, i had to remove erroneous positioning back till a parent div that was not constrained by overflow and height and width restraints that were impacting on the hover state div.

    a working jsfiddle is here:

    http://jsfiddle.net/rwone/eeaAr/

    i also implemented @Deepak Kamat’s suggestion to only have one id per page and change the rest of the div’s to be identified by classes.

    i subsequently read the article below that made more sense to me this time and after working in this context:

    http://css-tricks.com/the-difference-between-id-and-class/

    thank you to all for your assistance!

    html

    <div id="wrapper">
    <div id ="hbar_one"></div>
    <div id="hbar_two"></div>
    <div id="container_a">
    <div id="container_b">
    <div class="class1 class2 magic" data-unique-content=".hidden_db_data_div">
    <img src="http://lorempixel.com/g/50/50/">
    <div class="hidden_db_data_div">
    some amazing html
    </div>
    </div>
    <div class="class1 class2 magic" data-unique-content=".hidden_db_data_div">
    <img src="http://lorempixel.com/g/50/50/">
    <div class="hidden_db_data_div">
    more amazing html
    </div>
    </div>
    <div class="class1 class2 magic" data-unique-content=".hidden_db_data_div">
    <img src="http://lorempixel.com/g/50/50/">
    <div class="hidden_db_data_div">
    even more amazing html
    </div>
    </div>
    </div>
    </div>
    <div id="hbar_three"></div>
    <div id="hbar_four"></div>
    </div>
    

    css

    #wrapper {
    width: 300px;   
    }
    #hbar_one {
    background: #cc0000;   
    height: 50px;
    }
    
    #hbar_two {
    background: #ffcc00;   
    height: 50px;
    }
    
    #container_b {
    height: 100px;
    overflow-y: auto;
    }
    
    .hidden_db_data_div {
    display: none;
    background: #00AFF0;
    width: 120px;
    height: 150px;
    color: red;
    position:absolute;
    overflow: hidden; 
    z-index: 999;  
    }
    
    img {
    width: 50px;
    height: 50px;
    }
    
    .magic {
    display: inline;
    }
    
    #container_a { position:relative; }
    
    #hbar_three {
    background: #cccccc;   
    height: 50px;
    }
    
    #hbar_four {
    background: #000000;   
    height: 50px;
    }
    

    script

    $(".magic").hover(
    function () {
    $(this)
    .find('.hidden_db_data_div')
    .css({'left':$(this).position().left+20 + "px", 'top':'-20px'})
    .fadeIn(200);
    },
    function() { 
    $(this)
    .find('.hidden_db_data_div')
    .fadeOut(100);
    }                
    );
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I am reading a book about Javascript and jQuery and using one of the
I have this code to decode numeric html entities to the UTF8 equivalent character.
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
I have a jquery bug and I've been looking for hours now, I can't
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
this is what i have right now Drawing an RSS feed into the php,

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.