• user...">
    Geek Answers Handbook

    Bootstrap pull right buttons in list

    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> 

    enter image description here

    I would like to make the box larger so that the buttons are inside, while keeping the text / label vertically in the center. Alternatively, moving the buttons up to be inside the box will work. I am using bootstrap 3.2. Any advice is appreciated. Thanks.

    +8
    twitter-bootstrap twitter-bootstrap-3
    Ben Aug 14 '14 at 19:29
    source share
    3 answers

    The fix is ​​simple, just add clearfix to the element containing the floating elements:

      <li class="list-group-item clearfix"> 

    DEMO: http://jsbin.com/yazoj/1/edit

    AND

     .list-group {line-height:30px} 
    +9
    Christina Aug 14 '14 at 20:02
    source share

    Here is jsfiddle

    the 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 can move the inline style to a css file.

    +1
    Bongs Aug 14 '14 at 19:54
    source share

    I tried my code .. Yes, there is a problem. You can give an additional class of the first element li, and then specify an addition for this.

    For example, I gave an extra for the first li "custom-class"

     <div class="container"> <ul class="list-group"> <li class="list-group-item custom-class"> 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> 

    Now you can define the bottom of the pad for the custom class. You can increase the indentation as you wish.

      .custom-class{ padding-bottom: 30px } 

    Thanks:)

    0
    salam mohd Aug 14 '14 at 19:43
    source share

    More articles:

    • Why are there some features in LLVM? - clang
    • How to disable nexus-staging-maven-plugin in submodules - maven
    • Include Generated Resources in a Bank (SBT) - scala
    • "System.ArithmeticException" when updating layout - c #
    • When using Joi with Hapi, how to configure one of them to one key, but allow any other keys? - json
    • Change title when sweeping in Highcharts - javascript
    • Yii2 How to pass a range to search for a model - php
    • Does scala specification 2.10 and 2.11 exist? - scala
    • UART IO Interrupt Wizard - io
    • What to do if the HTTP headers contain both If-Modified-Since and If-None-Match - http

    All Articles

    Geek Answers | 2019