I have the following code:
<div class="container">
<ul class="list-group">
<li class="list-group-item">
userA <span class="label label-default">admin</span>
<span class="pull-right button-group">
<a href="/admin/userA" class="btn btn-primary"><span class="glyphicon glyphicon-edit"></span> Edit</a>
<button type="button" class="btn btn-danger"><span class="glyphicon glyphicon-remove"></span> Delete</button>
</span>
</li>
</ul>
</div>
I would like to make the box bigger so the buttons fit within, whilst keeping the text/label vertically centered. Alternatively, moving the buttons up to be within the box would work. I'm using bootstrap 3.2. Any advice welcome. Thanks.
The fix is simple, just add the clearfix to the element containing the floated items:
<li class="list-group-item clearfix">
DEMO:http://jsbin.com/yazoj/1/edit
And
.list-group {line-height:30px}
Here is jsfiddle
Code:
<div class="container">
<ul class="list-group">
<li class="list-group-item clearfix">
<!-- wrapped the text and label in a span -->
<span style="position:absolute; top:30%;">userA <span class="label label-default">admin</span></span>
<span class="pull-right button-group">
<a href="/admin/userA" class="btn btn-primary"><span class="glyphicon glyphicon-edit"></span> Edit</a>
<button type="button" class="btn btn-danger"><span class="glyphicon glyphicon-remove"></span> Delete</button>
</span>
</li>
</ul>
</div>
You may want to move the inline style to css file.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With