gpt4 book ai didi

html - 两个 Bootstrap 按钮在一行中右对齐

转载 作者:行者123 更新时间:2023-11-28 04:47:39 27 4
gpt4 key购买 nike

如果可能的话,我无法让两个按钮并排放置在面板的右侧。

这是一个fiddle使用我当前的解决方案。

<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">my panel title</h3>
</div>
<div class="panel-body">
<form action="#" class="form">
<div class="row">
<div class="col-sm-offset-10 col-sm-1">
<button type="submit" class="btn btn-default" id="btn1" name="btn1" value="1">button1</button>
</div>
<div class="col-sm-1">
<button class="btn btn-primary" id="btn2" name="btn2" value="2" type="submit">button2</button>
</div>
</div>
</form>
</div>
</div>

最佳答案

将两个按钮放在一列中 (col-*-*) 并使用 text-right 类作为父 div。

<div class="col-sm-12 text-right">
<button type="submit" class="btn btn-default" id="btn1" name="btn1" value="1">button1</button>
<button class="btn btn-primary" id="btn2" name="btn2" value="2" type="submit">button2</button>
</div>

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">my panel title</h3>
</div>
<div class="panel-body">
<form action="#" class="form">
<div class="row">
<div class="col-sm-12 text-right">
<button type="submit" class="btn btn-default" id="btn1" name="btn1" value="1">button1</button>
<button class="btn btn-primary" id="btn2" name="btn2" value="2" type="submit">button2</button>
</div>
</div>
</form>
</div>
</div>

关于html - 两个 Bootstrap 按钮在一行中右对齐,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40866800/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com