• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
CSS vertical menu - how do i get *some* child items to align to right edge of parent??

#1
[eluser]spheroid[/eluser]
I have a purely css menu that drops down child menus vertically. The parent menu is aligned to the right of the page. The child menus that drop down are left-aligned with their parent menu. Is there a way to easily adjust some menus (like the rightmost ones) to have their child menus align with the right of their parent?

Example:

Code:
MENU 1         MENU 2        MENU 3            MENU 4
MEN1 ITEM 1    MEN2 ITEM 1   MEN3 ITEM 1  MEN4 ITEM 1
MEN1 ITEM 2    MEN2 ITEM 2                MEN4 ITEM 2

Site is at: http://www.realadvice.com

#2
[eluser]GSV Sleeper Service[/eluser]
off the top of my head, no guarantee it'll work
Code:
//give your last menu header a class of 'last'
...
<li class="last">MENU 4
<ol>
<li>menu4 item 1</li>
<li>menu4 item 2</li>
</ol>
</li>

li.last ol {
text-align:right;
}

#3
[eluser]nstokes[/eluser]
You can fix it by adding two things:
Code:
#primary-nav li, #primary-nav li.menuparent {
position: relative; //Add this line
}

and

Code:
#primary-nav ul {
background:#E8EBF2 url(/images/realadvice/theme_launch/bg_topmenu2.gif) repeat-y scroll 0 0;
display:none;
position:absolute;
right:0;  // Add this line
top:auto;
}

That should align each submenu to the right side of the parent.

#4
[eluser]spheroid[/eluser]
@nstokes: Thanks a million, this worked! I ended up adding a #primary-nav-right as well to the css class file so I could declare a ul as id="primary-nav" or id="primary-nav-right".

#5
[eluser]nstokes[/eluser]
Glad to be of help.


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.