javascript - css ul list multiple item alignment -
i have ul element conatins multiple items in line. put list in 300px fixed panel.
<div class="panel panel-primary" style="width:300px"> <div class="panel-heading"> menu items</div> <div class="panel-body"> <ul> <li> <div class="content"> <button class="btn btn-sm btn-default"> <span class="glyphicon glyphicon-th" ></span> </button> long menu item name <div class="settings"> <div class="show-settings pull-rigth"> <div class="btn-group pull-right"> <button class="btn btn-xs btn-info"> <span class="glyphicon glyphicon-eye-open"></span> </button> <button class="btn btn-xs btn-info"> <span class="glyphicon glyphicon-eye-close"></span> </button> </div> </div> <button class="btn btn-xs btn-default pull-right"> <span class="glyphicon glyphicon-cog"></span> </button> </div> </div> </li> </ul> </div>
and css settings here
ul, li { list-style: none; margin: 0; padding: 0; } ul { padding-left: 1em; } li { padding-left: 0; } .show-settings{ display: none; } .settings:hover .show-settings{ display : block; } .content{ position: relative; padding: .4em .4em .4em 0.2em; *padding: .4em; margin: .5em 0; background: #d9edf7 ; color: #444; text-decoration: none; border-radius: .3em; }
my settings class item going out of blue content.
my settings button count may 3 or 4. possible overflow menu item text this:
or flowing new line in content.
i have modified structure bit. try below code, can fine tune it.
html
<div class="panel panel-primary" style="width:300px"> <div class="panel-heading"> menu items</div> <div class="panel-body"> <ul> <li> <div class="content"> <button class="btn btn-sm btn-default"> <span class="glyphicon glyphicon-th" ></span> </button> <span class="title">a long menu item name long menu item name</span> <div class="settings"> <button class="btn btn-xs btn-default pull-right"> <span class="glyphicon glyphicon-cog"></span> </button> <div class="show-settings pull-rigth"> <button class="btn btn-xs btn-info pull-right"> <span class="glyphicon glyphicon-eye-open"></span> </button> <button class="btn btn-xs btn-info pull-right"> <span class="glyphicon glyphicon-eye-close"></span> </button> </div> </div> </div> </li> </ul> </div> </div>
css
ul, li { list-style: none; margin: 0; padding: 0; } ul { padding-left: 1em; } li { padding-left: 0; } .show-settings{ display: none; } .settings{ position: absolute; top: 8px; right: 9px; width: 75px; } .settings:hover .show-settings{ display : block; } .content{ position: relative; padding: .4em .4em .4em 0.2em; *padding: .4em; margin: .5em 0; background: #d9edf7 ; color: #444; text-decoration: none; border-radius: .3em; position: relative; } span.title { display: inline-block; width: 70%; padding-left: 3px; } .btn-default{ vertical-align: top; }
Comments
Post a Comment