dongzongzhi6953 2016-09-15 12:14
浏览 93
已采纳

Yii2基本背景变化

Im using bootstrap and Im trying to set a background image for the login screen.I try with div with id that catch all the things and set the background but didnt work .

Here my Login.php

<div id="bimg">
<div  class="site-login">
    <h1><?= Html::encode($this->title) ?></h1>

    <p>Please fill out the following fields to login:</p>



    <?php
    $form = ActiveForm::begin([
                'id' => 'login-form',
                'options' => ['class' => 'form-horizontal'],
                'fieldConfig' => [
                    'template' => "{label}
 <div class=\"center\"><div class=\"col-lg-3\">{input}</div>
<div class=\"col-lg-8\">{error}</div></div>",
                    'labelOptions' => ['class' => 'col-lg-1 control-label'],
                ],
    ]);
    ?>

    <?= $form->field($model, 'email')->textInput(['autofocus' => true, 'placeholder' => 'Write your email address']) ?>

    <?= $form->field($model, 'password')->passwordInput(['placeholder' => 'Write your password']) ?>

    <?=
    $form->field($model, 'rememberMe')->checkbox([
        'template' => "<div class=\"col-lg-offset-1 col-lg-3\">{input} {label}</div>
<div class=\"col-lg-8\">{error}</div>",
    ])
    ?>

    <div class="form-group">
        <div class="col-lg-offset-1 col-lg-11">
            <div>
                <?= Html::a(Yii::t("app", "Forgotten  password") . "?", ["/site/forgot"]) ?>
                <br>
            </div>
            <br>
            <?= Html::submitButton('Login', ['class' => 'btn btn-primary', 'name' => 'login-button']) ?>
        </div>
    </div>
    <?php ActiveForm::end(); ?>
</div>

and the class with path in bootstrap.css

#bimg{
width:100%;
background-image: url(../web/assets/css/images/5.jpg) !important;

}

  • 写回答

1条回答 默认 最新

  • drby30217 2016-09-19 15:11
    关注

    In layouts-main.php controller->action->id == 'login') ? 'background-wrapper' : NULL ?>"> Check on which page u are , and if u are the page u want set the "class" u want

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

报告相同问题?

悬赏问题

  • ¥100 任意维数的K均值聚类
  • ¥15 stamps做sbas-insar,时序沉降图怎么画
  • ¥15 unity第一人称射击小游戏,有demo,在原脚本的基础上进行修改以达到要求
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看
  • ¥15 关于#Java#的问题,如何解决?
  • ¥15 加热介质是液体,换热器壳侧导热系数和总的导热系数怎么算
  • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计
  • ¥15 cmd cl 0x000007b
  • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line
  • ¥500 火焰左右视图、视差(基于双目相机)