stand
stand

Reputation: 139

Several buttons in one line

How could I post two buttons in one horizontal line?

<div style="width: 50%; margin: 0 auto; text-align: center;">
    <?php $form = ActiveForm::begin(['id' => 'one_week_ago', 'method' => 'GET',]) ?>
    <input type="hidden" value="1" name="one_week_ago">

    <div class="form-group">
        <?= Html::submitButton('Прошлая неделя', ['class' => 'btn btn-primary', 'name' => 'last1']) ?>
    </div>

    <?php ActiveForm::end(); ?>
    <?php $form1 = ActiveForm::begin(['id' => 'two_week_ago', 'method' => 'GET']); ?>
    <input type="hidden" value="2" name="two_week_ago" >

    <div class="form-group">
        <?= Html::submitButton('Позапрошлая неделя', ['class' => 'btn btn-primary', 'name' => 'last2']) ?>
    </div>

    <?php ActiveForm::end();?>


</div>

There are in different ActiveForm.

Upvotes: 0

Views: 51

Answers (1)

Steve
Steve

Reputation: 90

Use

float:left;

as css commands for both buttons. For example:

<div class="form-group" style="float:left;">

Make sure to close the floating by adding

<div style="clear:both;"></div>

before

<?php ActiveForm::end();?>

Upvotes: 1

Related Questions