Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

CSS sub menu confusion

Posted on 2011-10-01
8
Medium Priority
?
297 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 1000 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 44

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
 
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 44

Assisted Solution

by:Chris Stanyon
Chris Stanyon earned 1000 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Styling your websites can become very complex. Here I'll show how SASS can help you better organize, maintain and reuse your CSS code.
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…
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…
Suggested Courses

879 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