一行中的两个按钮

时间:2017-02-04 20:48:10

标签: php html

如何将此按钮放在一行?

<form method="post">
    <button type="submit" name="render_button" class='btn btn-block btn-primary' style="width:100px;height:30px;" > Render </button>

    <button type="submit" name="check" class='btn btn-block btn-primary' style="width:100px;height:30px;" > Render2 </button>
</form>

2 个答案:

答案 0 :(得分:1)

如果使用Bootstrap,我用btn btn-primary标签猜测,只需将 display:inline-block; 添加到每个样式标记:

注意:您可能必须在第二个按钮的边距顶部输出0,我也会添加它。

<form method="post">
        <button type="submit" name="render_button" class='btn btn-block btn-primary' style="width:100px;height:30px;display:inline-block;" > Render </button>

        <button type="submit" name="check" class='btn btn-block btn-primary' style="width:100px;height:30px;display:inline-block;margin-top:0;" > Render2 </button>
</form>

答案 1 :(得分:1)

我认为btn-block类是你的罪魁祸首,如果删除它,按钮应该显示为内联元素

<form method="post">
    <button type="submit" name="render_button" class='btn btn-primary' style="width:100px;height:30px;" > Render </button>

    <button type="submit" name="check" class='btn btn-primary' style="width:100px;height:30px;" > Render2 </button>
</form>