menuitem - Simple CSS Menu Adjustment -
i having minor issue ie7 (whats new)...
i trying create simple, "button" has basic effects when mouse-over show small menu. such "actions". perhaps select multiple items on page , want apply actions them.
so code, , seems work fine, except in ie7. displays menu @ 100% width, , don't want that.... want display width or button-text.
if have ideas on tweaking this, appreciated.
<style> * { margin: 0; padding: 0; } body { font-family:arial, helvetica, sans-serif; } /* overall button layout */ .dropbutton { display: block; position: relative; background-color: #0073ea; color: #fff; list-style: none; margin: 0; padding: 0; z-index: 100; } /* head button visual */ .dropbutton li { padding: 3px 10px; color: #fff; text-decoration: none; display: inline-block; } /* sub-menu display */ .dropbutton ul { position: absolute; left: -99999px; list-style: none; background: #fff; border: solid 1px #d2d2d2; z-index: 105!important; } /* menu listed items */ .dropbutton ul { color: #0073ea; display: block; white-space: nowrap; } /* bring drop-menu visual scope */ .dropbutton li:hover ul { left: 0; } /* sub menu items upon hover */ .dropbutton li:hover ul li a:hover { background: #f1f1f1; } </style> <ul class="dropbutton"> <li><a href="#">actions</a> <ul> <li><a href="">delete selected</a></li> <li><a href="">add category</a></li> </ul> </li> </ul>
i able adjust own problem, posted personal solution. ie there couple of quirks had use float solve problem. here solution
<style> * { margin: 0; padding: 0; } body { font-family:arial, helvetica, sans-serif; } /* drop down button design ------------------------------------------- */ /* need add clearing ie */ .clr { clear: both; } /* overall button layout */ .dropbutton { display: inline-block; float:left; position: relative; background-color: #0073ea; color: #fff; list-style: none; margin: 0; padding: 0; z-index: 100; } /* head button visual */ .dropbutton li { padding: 3px 10px; color: #fff; text-decoration: none; display: block; } /* sub-menu display */ .dropbutton ul { position: absolute; left: -99999px; list-style: none; background: #fff; border: solid 1px #d2d2d2; z-index: 105!important; } /* menu listed items */ .dropbutton ul { color: #0073ea; display: block; white-space: nowrap; } /* bring drop-menu visual scope */ .dropbutton li:hover ul { left: 0; } /* sub menu items upon hover */ .dropbutton li:hover ul li a:hover { background: #f1f1f1; } /* seperation within menu */ .dropbutton .sep { border-top: solid 1px #d2d2d2; width: 100%; } /* end of button ----------------------------- */ </style> <ul class="dropbutton"> <li><a href="#">actions</a> <ul> <li><a href="#">delete selected</a></li> <li class="sep"><a href="#">add category</a></li> </ul> </li> <div class="clr"></div> </ul> <ul class="dropbutton"> <li><a href="#">actions</a> <ul> <li><a href="#">delete selected</a></li> <li><a href="#">add category</a></li> </ul> </li> <div class="clr"></div> </ul>
Comments
Post a Comment