Current location: Hot Scripts Forums » General Web Coding » CSS » CSS Drop Down Menu <ul> Hover


CSS Drop Down Menu <ul> Hover

Reply
  #1 (permalink)  
Old 06-01-10, 09:51 AM
xavier039 xavier039 is offline
Newbie Coder
 
Join Date: Aug 2006
Posts: 56
Thanks: 0
Thanked 0 Times in 0 Posts
CSS Drop Down Menu <ul> Hover

Right now I have my drop down menu up and working. However, the when you hover over the <ul> it disappears when you hover over a <li> I would like it to stay.

Here is a link to see. Thrive - Navigating Insights
Reply With Quote
  #2 (permalink)  
Old 06-02-10, 10:49 AM
scott2500uk's Avatar
scott2500uk scott2500uk is offline
Coding Addict
 
Join Date: Apr 2006
Posts: 275
Thanks: 2
Thanked 2 Times in 2 Posts
The entire page layout is broken in IE.

Without trying to sound mean I think you need to start from the top again.

As for your navigation the only thing u should have inbetween <ul></ul> are <li>'s why are you using spans?

Your navigation should go something like this:

HTML Code:
<ul id="navigation">
  <li>First Menu Link
    <ul>
      <li>Sub Menu Link</li>
      <li>Sub Menu Link</li>
      <li>Sub Menu Link</li>
    </ul>
  </li>
  <li>Second Menu Link
    <ul>
      <li>Sub Menu Link</li>
      <li>Sub Menu Link</li>
      <li>Sub Menu Link</li>
    </ul>
  </li>
  <li>Third Menu Link
    <ul>
      <li>Sub Menu Link</li>
      <li>Sub Menu Link</li>
      <li>Sub Menu Link</li>
    </ul>
  </li>
</ul>
You can then style the nav you are after by targeting the navigation elements using CSS selectors:

Code:
ul#navigation li {}
ul#navigation li ul {}
ul#navigation li ul li {}
you can add more classes to each li to target an individual list item to do something different.

As a tip you can float LI elements to get them to apear on one line. Also you can use border with a bit of padding and margin to get the | effect you are after too without having to put in seperate seperator code.
Reply With Quote
  #3 (permalink)  
Old 08-04-10, 08:44 AM
decompilando decompilando is offline
New Member
 
Join Date: Aug 2010
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
yes first check the doctype stay out of ie5.5 you could trigger quirksmode,

i use this one.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

Last edited by decompilando; 08-04-10 at 08:47 AM.
Reply With Quote
  #4 (permalink)  
Old 12-03-10, 07:24 AM
bebeinc bebeinc is offline
New Member
 
Join Date: Dec 2010
Location: nigeria
Posts: 2
Thanks: 1
Thanked 0 Times in 0 Posts
nice one fellas been looking out for that
Reply With Quote
  #5 (permalink)  
Old 07-11-11, 12:29 AM
webtechie webtechie is offline
New Member
 
Join Date: Jul 2011
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
CSS Drop Down Menu <ul> Hover

Html Coad:

<div class="navigation">

<ul>

<li><a href="index.php">Home 01</a></li>

<li><a href="about.php">Home 02</a></li>

<li><a href="#">Home 03</a>
<ul>
<li><a href="men.php">Home A</a></li>
<li><a href="women.php">Home B</a></li>
<li><a href="success-stories.php">Home C</a></li>
</ul>
</li>

<li><a href="#">Home 04</a>
<ul>
<li><a href="matchmaker-facts.php">Home A</a></li>
<li><a href="date-facts.php">Home B</a></li>
</ul>
</li>

<li><a href="consultation.php">Home 05</a></li>

<li><a href="newsletter.php">Home 06</a></li>

<li><a href="contact.php">Home 07</a></li>

</ul>

</div>

Css Code:

.navigation{
height:40px;
font:normal 13px/40px "Arial", Helvetica, sans-serif;
color:#a9a9a9;
text-shadow: 0px 1px #444;
background:url(../images/navigation_bg.png) 0 0 no-repeat;
width:970px;
margin:0 auto;
}

.navigation ul{
padding:0;
margin:0;
list-style:none;
}

.navigation ul li{
padding:0;
float:left;
font:normal 13px/40px "Arial", Helvetica, sans-serif;
color:#a9a9a9;
text-shadow: 0px 1px #444;
margin:0px 12px;
position:relative;
}

.navigation ul li a{
font:normal 13px/40px "Arial", Helvetica, sans-serif;
color:#a9a9a9;
text-decoration:none;
text-shadow: 0px 1px #444;
}

.navigation ul li a:hover{
background:url(../images/hover_left.png) left 10px no-repeat;
color:#ffffff;
text-decoration:none;
}

.navigation ul li ul{
display:none;
position:absolute;
background-color:#252525;
padding:10px;
}

.navigation ul li ul li{
float:none;
padding:0;
margin:0;
width:150px;
font:normal 13px/24px "Arial", Helvetica, sans-serif;
color:#a9a9a9;
text-decoration:none;
z-index:100;
}

.navigation ul li ul li a{
font:normal 13px/24px "Arial", Helvetica, sans-serif;
color:#a9a9a9;
text-decoration:none;
}

.navigation ul li ul li a:hover{
color:#a9a9a9;
}

.navigation ul li:hover > ul{
display:block;
}

Reply With Quote
Reply

Bookmarks

Tags
css, drop down menu


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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 Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Superfish jquery menu problems with modification transcend2005 CSS 2 03-25-09 01:30 AM
css problem with the scroll bar crazy.works CSS 0 11-04-08 05:34 PM
AnyLink Drop Down Menu - Smarty Error? shadyy510 JavaScript 2 05-08-08 11:44 AM
css drop down menu help! Space Cowboy CSS 2 01-10-07 12:36 AM
Xml / Dom / Css Mark_SC.SE JavaScript 0 06-29-05 08:05 AM


All times are GMT -5. The time now is 02:29 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.