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
Old 01-08-2007, 06:14 PM drop down menu help
Junior Talker

Posts: 1
Name: Tom
Trades: 0
Hi All,

I am trying to figure out drop down menus using only css and am a little puzzled. I understand how to create a vertical menu where when you hold your mouse over the link a sub menu appears to the right of the list, but it dissapears once you move the mouse away.

What i want is the menu to appear underneath the link that was clicked, but i only want the menu to appear when the link is clicked and to stay there until another main link is clicked.

Can anyone help me. The code i have got from a tutorial page is:

Code:
<body>

<ul>
  <li><a href="#">Home</a></li>
  <li><a href="#">About</a>
      <ul>
        <li><a href="#">History</a></li>
        <li><a href="#">Team</a></li>
        <li><a href="#">Offices</a></li>
      </ul>
  </li>
  <li><a href="#">Services</a>
      <ul>
        <li><a href="#">Web Design</a></li>
        <li><a href="#">Internet 
          Marketing</a></li>
        <li><a href="#">Hosting</a></li>
        <li><a href="#">Domain Names</a></li>
        <li><a href="#">Broadband</a></li>
      </ul>
  </li>
  <li><a href="#">Contact Us</a>
      <ul>
        <li><a href="#">United Kingdom</a></li>
        <li><a href="#">France</a></li>
        <li><a href="#">USA</a></li>
        <li><a href="#">Australia</a></li>
      </ul>
  </li>
</ul>
</body>
and the css is:

Code:
body {
    font: normal 11px verdana;
    }

ul {
    margin: 0;
    padding: 0;
    list-style: none;
    width: 150px; /* Width of Menu Items */
    border-bottom: 1px solid #ccc;
    }

ul li {
    position: relative;
    }
    
li ul {
    position: absolute;
    left: 149px; /* Set 1px less than menu width */
    top: 0;
    display: none;
    }

/* Styles for Menu Items */
ul li a {
    display: block;
    text-decoration: none;
    color: #777;
    background: #fff; /* IE6 Bug */
    padding: 5px;
    border: 1px solid #ccc;
    border-bottom: 0;
    }

ul li a:hover { 
color: #E2144A; background: #f9f9f9; 
} 
/* Hover Styles */
        
li ul li a { 
padding: 2px 5px; 
} 

/* Sub Menu Styles */
        
li:hover ul, li.over ul { 
display: block; 
}
what should i change to get this? I know i need to do something with visible and visited, but i can't figure this out.

Any help would be appreciated.
tbathgate is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 01-08-2007, 08:36 PM Re: drop down menu help
vangogh's Avatar
Post Impressionist

Posts: 10,688
Name: Steven Bradley
Location: Boulder, Colorado
Trades: 0
Tom I think you'll need to use JavaScript if you want the menu to appear only when the link is clicked. I think with CSS it will have to appear on the :hover.
__________________
l Search Engine Friendly Web Design |
Please login or register to view this content. Registration is FREE

l Tips On Marketing, SEO, Design, and Development |
Please login or register to view this content. Registration is FREE

l
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
vangogh is offline
Reply With Quote
View Public Profile Visit vangogh's homepage!
 
Reply     « Reply to drop down menu help
 

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.47112 seconds with 12 queries