Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

CSS Forum


You are currently viewing our CSS Forum as a guest. Please register to participate.
Login



Reply
[Pure CSS] Is this even possible using selectors?
Old 02-08-2011, 10:52 PM [Pure CSS] Is this even possible using selectors?
Whathadiv's Avatar
Super Talker

Posts: 99
Name: Justin Paul
Trades: 0
Hi everyone,

I've been working at this for a while now and it's time to get some help :

I'm building a sort of navigation with pure CSS and CSS3. My problem has to do with CSS selectors.

I need to show an image that is behind two other elements when hovering over a menu <li> that is above those two elements. (Simply using z-index doesn't work)

Now I can use selectors like

Code:
 ul.menuBuild li .img1{display:none;}
    
    ul.menuBuild li:hover + .img1{display:block;}
to show the image but that only works if the image is a child of the hovered element. I need to select and element that is not a child of the hovered element.

Here is my HTML:

Code:
<body>
<div id="menu-wrap">
<div class="wrap1">
<div class="wrap2">
<div class="wrap3">
<div class="wrap4"> 
<span class="img1"><img class="orbit orbit-frame" src="images/card08.jpg" alt="card08" /></span>
<div class="completer"></div>
<div class="completer2"></div>
<div class="wrap5">
<div class="nav-holder">

<!-- start menu !-->

<ul class="menuBuild">

  <li id="menu1"><a href="#">Lips</a>
    <ul class="submenu sub1">
      <li class="first"><a href="cat.html">Cat</a></li>
      <li class="second"><a href="rabbit.html">Rabbit</a></li>
      <li><a href="dingo.html">Dingo</a></li>
      <li class="third"><a href="cat.html">Cat</a></li>
      <li class="last"><a href="dingo.html">Dingo</a></li>
    </ul>
  </li>
  
  <li id="menu2"><a href="#">Ears</a>
    <ul class="submenu sub2">
      <li class="first"><a href="monkey.html">Monkey</a></li>
      <li class="second"><a href="dog.html">Dog</a></li>
    </ul>
  </li>
  
  <li id="menu3"><a href="#">Eyes</a>
    <ul class="submenu sub3">
      <li class="first"><a href="pig.html">Pig</a></li>
      <li class="second"><a href="bird.html">Bird</a></li>
      <li><a href="worm.html">Worm</a></li>
    </ul>
  </li>
  
  <li id="menu4"><a href="accessibleLink.html">Noses</a>
    <ul class="submenu sub4">
      <li class="first"><a href="bat.html">Bat</a></li>
      <li class="second"><a href="fish.html">Fish</a></li>
      <li><a href="panther.html">Panther</a></li>
    </ul>
  </li>
  
</ul>

<!-- end menu !-->

</div><!-- nav holder !-->
</div><!-- wrap5 !-->
</div><!-- wrap4 !-->
</div><!-- wrap3 !-->
</div><!-- wrap2 !-->
</div><!-- wrap1 !-->
</div><!-- menu-wrap !-->


<script type="text/javascript" src="http://code.jquery.com/jquery-latest.js"></script>
</body>
The image MUST stay between the wrap 4 and completer divs.

The menu MUST stay under the nav-holder div.

I hope I've explained my okay. Thanks a bunch :eye:
__________________

Please login or register to view this content. Registration is FREE
Whathadiv is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 02-09-2011, 07:32 AM Re: [Pure CSS] Is this even possible using selectors?
Extreme Talker

Posts: 246
Trades: 0
When using z-index, do you have the position set to absolute? If not I don't believe it'll work.
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
stbuchok is offline
Reply With Quote
View Public Profile
 
Old 02-09-2011, 12:25 PM Re: [Pure CSS] Is this even possible using selectors?
Whathadiv's Avatar
Super Talker

Posts: 99
Name: Justin Paul
Trades: 0
Yes I have positions set but it doesn't work on the image alone because it's inside the menuBuild so I would have to use z-index on the whole menu.
__________________

Please login or register to view this content. Registration is FREE
Whathadiv is offline
Reply With Quote
View Public Profile
 
Old 02-09-2011, 01:10 PM Re: [Pure CSS] Is this even possible using selectors?
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,376
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
Quote:
Originally Posted by Whathadiv View Post
Yes I have positions set but it doesn't work on the image alone because it's inside the menuBuild so I would have to use z-index on the whole menu.
elements that are positioned absolutely are not necessarily constrained by the parent element.
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Reply     « Reply to [Pure CSS] Is this even possible using selectors?
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.52315 seconds with 12 queries