CSS Drop down menu; how to align the right edge of drop down and parent menu?
Posted: 26 July 2010 08:51 PM   [ Ignore ]
Newbie
Rank
Total Posts:  3
Joined  2010-07-26

Hello everyone,

I have a drop-down menu that is currently working well.

The only change I need to make is to have the right edge of the drop-down menu to align with the right edge of the parent menu. When you hover over the menu, it currently “drops” down and to the right, with the left edges aligned.

I want the menu to “drop” down and to the left, so the right edges are aligned.

I have tried fiddling with floats and absolute/relative positioning. I’m not sure what needs to be changed.

Any help you can provide is greatly appreciated! I’m learning via “cut and paste”, so please go easy on any terminology you may use.

Thank you!

Here is the page: http://www.littlebuddymedia.com/site05/012.html

The menu currently drops like this (aligned along the left edge): http://www.justskins.com/wp-content/uploads/2008/12/drop-down-menu.gif

I want the menu to do this (align along the right edge; see how “Artists” is aligned under “Music” along the right edge): http://artatm.com/wp-content/uploads/2009/11/mtvmenu.JPG

Here is my code:

.chromestyle{
     width
100%;
     
font-weightbold;
     
floatleft;
     
height29px;
}

.chromestyle:after{ /*Add margin between menu and rest of content in Firefox*/
content"."
displayblock
height0
clearboth
visibilityhidden;
}

.chromestyle ul{
border
0px solid #BBB;
width100%;
backgroundurl(chromebg.gifcenter center repeat-x/*THEME CHANGE HERE*/
padding4px 0;
margin0;
text-alignright/*set value to "left", "center", or "right"*/
}

.chromestyle ul li{
display
inline;
}

.chromestyle ul li a{
color
#000000;
padding4px 7px;
margin0;
text-decorationnone;
border-left1px solid #DADADA;
}

.chromestyle ul li a:hover, .chromestyle ul li a.selected{ /*script dynamically adds a class of "selected" to the current active menu item*/
backgroundurl(chromebg-over.gifcenter center repeat-x/*THEME CHANGE HERE*/
}

/* ######### Style for Drop Down Menu ######### */

.dropmenudiv{
position
:absolute;
top0;
border1px solid #BBB; /*THEME CHANGE HERE*/
border-bottom-width0;
font:normal 12px Verdana;
line-height:18px;
z-index:100;
background-colorwhite;
width200px;
visibilityhidden;
}


.dropmenudiv a{
width
auto;
displayblock;
text-indent3px;
border-bottom1px solid #BBB; /*THEME CHANGE HERE*/
padding2px 5px;
text-decorationnone;
font-weightbold;
colorblack;
}

html .dropmenudiv a{ /*IE only hack*/
width100%;
}

.dropmenudiv a:hover{ /*THEME CHANGE HERE*/
background-color#0000ff;
color#fff200;
Profile
 
 
Posted: 26 July 2010 10:20 PM   [ Ignore ]   [ # 1 ]
Newbie
Rank
Total Posts:  3
Joined  2010-07-26

Here is a graphic for clarification of what I want to do:

http://www.littlebuddymedia.com/help/menuhelp.jpg

Profile