很多軟件都用這種效果,右邊是效果圖,使用的時候很簡單,給<popup>標簽加上CSS定義就可以了,如紅色部分所示
菜單我挑了一個代碼少的,效果一樣哈
<popup id="emailAddressPopup" popupanchor="bottomleft" onpopupshowing="goUpdateCommand('cmd_createFilterFromPopup');" class="popMunu">
<menuitem label="&SendMailTo.label;" accesskey="&SendMailTo.Accesskey;" oncommand="SendMailToNode(document.popupNode)"/>
<menuitem label="&CreateFilterFrom.label;" accesskey="&CreateFilterFrom.Accesskey;" command="cmd_createFilterFromPopup"/>
<menuitem label="&AddToAddressBook.label;" accesskey="&AddToAddressBook.Accesskey;" oncommand="AddNodeToAddressBook(document.popupNode)"/>
<menuitem label="&CopyEmailAddress.label;" accesskey="&CopyEmailAddress.Accesskey;" oncommand="CopyEmailAddress(document.popupNode)"/>
</popup>
下面是CSS文件部分,其中popmune_left.png是藍色的漸變圖
.popMunu{
border: 1px solid #A0A0A0;
background-color: #FAFAFA;
padding: 0 2px 0 26px;;
margin: 0;
color: Black;
line-height: 1.5em;
background-image: url(images/popmune_left.png);
background-repeat: repeat-y;
}
.popMunu menuitem{
margin:1px 0;
padding: 2px 0;
}
.popMunu menuitem:hover{
background-color: #D5DFF1;
color: Black;
}