[SOLVED] submenu lines out wrong

For discussion and questions related to CMS Specific templates and stylesheets (CSS), and themes. or layout issues. This is not a place for generic "I don't know CSS issues"
Post Reply
User avatar
frankmanl
Power Poster
Power Poster
Posts: 425
Joined: Sat Jul 12, 2008 3:50 am

[SOLVED] submenu lines out wrong

Post by frankmanl »

I want my submenu to line out with its parent when hovering the parent.

Code: Select all

.menu ul ul { 
	display: none; 
	position: absolute; 
	top: 0;   /*3px for a little bump down for second level ul */
	left: 100%; /* keep left side of this ul on right side of the one it came out of */
	min-width: 10em;
	background-color: #8BC542;
	z-index: 999;
}
But it lines out with ul.primary-nav in stead.
What did I do wrong?
Attachments
submenu.jpg
Last edited by frankmanl on Thu Jan 02, 2014 6:41 pm, edited 1 time in total.
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12711
Joined: Thu Mar 09, 2006 5:32 am

Re: submenu lines out wrong

Post by Dr.CSS »

You have a few things going wrong here, the UL has position: on it(not needed) but the UL LI has overflow:hidden which is messing with the hover effect when you take the position out of the top UL...

I would have used one of the default style sheets like http://multiintech.com/default/cssmenu_vertical.html with the style changes you needed...
User avatar
velden
Dev Team Member
Dev Team Member
Posts: 3497
Joined: Mon Nov 28, 2011 9:29 am

Re: submenu lines out wrong

Post by velden »

Alway remember: when using position:absolute it's position is ALWAYS relative to its first positioned (not static) ancestor element

So if you want to make it absolute relative to the menu item, then make sure the parent li has position set:

Code: Select all

.menu > ul > li {
    display: inline-block;
    position: relative;
}
Then remove the overflow from the li:

Code: Select all

.menu ul li {
    margin: 0;
/*    overflow: hidden; */
    padding: 0;
    width: 100%;
}
User avatar
frankmanl
Power Poster
Power Poster
Posts: 425
Joined: Sat Jul 12, 2008 3:50 am

Re: [SOLVED] submenu lines out wrong

Post by frankmanl »

Thank you, this solved it.

Frank
Post Reply

Return to “Layout and Design (CSS & HTML)”