Solved

CSS sub menu confusion

Posted on 2011-10-01
8
286 Views
Last Modified: 2012-06-27
Hi All,

I have a Joomla template giving me fits. The menu and sub-menu items look correct in the HTML (I have the correct selections to show a submenu in Joomla admin), but the template itself did not come with any CSS for sub menus. I can't get the submenu to appear on mouseover of the main item no matter what combination of UL LI UL styling I try. The Philosophy link on this page should display the sub menu.
http://www.maxgeekweb3.com/

I'm a long-time CSS newb so I'm hoping this is easy for a CSS master. All I really want to do is show a black submenu with the same orange text choices as the main menu items.

Thanks

Bill
0
Comment
Question by:billium99
  • 3
  • 3
  • 2
8 Comments
 
LVL 16

Accepted Solution

by:
SSupreme earned 250 total points
ID: 36897937
1. Remove top attribute:
ul.menu-nav li:hover ul {
    top: 100%;
    visibility: visible;
}
2. change background to Black:
ul.menu-nav li ul {
    background: url("../images/spacer.gif") repeat scroll 0 0 black;
    left: 0;
    margin: -10px 0 0 -30px;
    min-height: 0;
    padding: 10px 30px 30px;
    position: absolute;
    top: 0;
    visibility: hidden;
}
3. Add z-index and change value of top:
ul.menu-nav li ul {
    background: url("../images/spacer.gif") repeat scroll 0 0 black;
    left: 0;
    margin: -10px 0 0 -30px;
    min-height: 0;
    padding: 10px 30px 30px;
    position: absolute;
    top: 60px;
    visibility: hidden;
z-index:1;
}
0
 
LVL 1

Author Comment

by:billium99
ID: 36898342
Hmmm - that didn't seem to change the behavior. Did I edit the CSS correctly? I think I followed your instructions properly.

Thanks for your time!

Bill
0
 
LVL 16

Expert Comment

by:SSupreme
ID: 36899077
I cannot find this rule: ul.menu-nav li:hover ul {
    visibility: visible;
}
did you remove it all?
0
 
LVL 42

Expert Comment

by:Chris Stanyon
ID: 36899376
As SSupreme says, you have no rule for showing the submenu. Add the following code to the bottom of your template.css file.

You may need to style the submenu differently than the main menu. You can do this by adding (or editing) the following rules

ul.menu-nav li.parent ul {} -for the main submenu
ul.menu-nav li.parent ul li {} - for each submenu item (li)
ul.menu-nav li.parent:hover ul {
    visibility: visible;
}

Open in new window

0
Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

 
LVL 1

Author Comment

by:billium99
ID: 36899391
OK - now the submenu appears, but I can't get my mouse down to it - it disappears the moment the mouse rolls off the parent item.
0
 
LVL 16

Expert Comment

by:SSupreme
ID: 36899417
You have to adjust position of submenu as you wanted I recommend you to disable hidden visibility for a while.
But also you have to consider to increase nav heigth because it's less than it's shown, I think you can make black banner as one module, eventing else header.
Have a look: blueborderzone is where your hover become active. blue zoneHere you can see submenu, there should not be any gap between blueborderzones, because hover rule will stop any submenu will disappear.
 submenu
0
 
LVL 42

Assisted Solution

by:Chris Stanyon
Chris Stanyon earned 250 total points
ID: 36899430
That's because your hover action is on the LI but there is a gap between the LI and your submenu (based on you moving the submenu down by 60px); As soon as you hit that gap with your mouse, the sub menu will hide again. You have a couple of options for removing the gap.

1. Don't move the submenu down that far (ul.menu-nav li ul { top:40px; }
2. Make your LIs in the main menu taller, so they meet with the top of the submenu (ul.menu-nav li { height:45px; }

Either way, you may have to tweak other styles.
0
 
LVL 1

Author Closing Comment

by:billium99
ID: 36901007
Thanks for the help and patience guys!

Bill
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Why do we like using grid based layouts in website design? Let's look at the live examples of websites and compare them to grid based WordPress themes.
This article describes how to create custom column layout styles for Bootstrap. The article uses 5 columns to illustrate the concept, but the principle can be extended to any number of columns.
In this Micro Tutorial viewers will learn how to create a CSS image sprite (In a later tutorial, viewers will learn how to use CSS and HTML to create a navigation menu using this sprite) Open a new Photoshop document with a width of (Icon width)x(N…
In this tutorial viewers will learn how to style different bullet points for unordered lists in CSS. Begin with a normal unordered list; the default bullet point is a solid circle: In the CSS, create a defined class of unordered list by typing "ul.S…

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now