dongshendi3599 2018-01-28 19:51
浏览 104
已采纳

面板中的垂直中心引导右对齐按钮

I have a bootstrap panel and need a button right-aligned and vertically-centered in the panel - I'm stumped. I'm working in Laravel 5.5 PHP on XAMPP.

I can right-align it but it sticks to off the bottom right corner. I have tried many suggestions here to vertically align it, but anytime I succeed with the vertical alignment I lose the right-alignment. I have tried text-align:right instead of float:right, I've tried display:inline-block, display:flex and align-self:center, all to no avail.

Here's my code that right-aligns, but the button is placed to the bottom and partially outside of the panel.

 <div class="col-md-6">
    <div class="panel panel-default" >
        <div class="panel-heading" style="background-color:#f37735;color:white"><h3><b>Employment History</b></h3>
        <button class="btn btn-primary" type="button" style="float:right;" data-toggle="collapse" data-target="#collapseEmployment" aria-expanded="false" aria-controls="collapseEmployment">
            Show Items
        </button>
        </div> .....

Here's a pic of what I have. The red arrow is where I need to place the button. button placement Any and all suggestions are most welcome - thanks.

  • 写回答

1条回答 默认 最新

  • dongmin4990 2018-01-28 20:01
    关注

    just put the button inside the header.

    <div class="col-md-6">
        <div class="panel panel-default">
            <div class="panel-heading" style="background-color:#f37735;color:white"><h3><b>Employment History</b>
            <button class="btn btn-primary btn-sm" type="button" style="float:right;" data-toggle="collapse" data-target="#collapseEmployment" aria-expanded="false" aria-controls="collapseEmployment">
                Show Items
            </button>
            </h3>
            </div>
       </div>
    </div>
    

    DEMO https://www.bootply.com/Z7RSrnEIYb

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器