Yii2 Form表單樣式修改

以下爲主要的樣式修改的代碼,大家可以看着修改。如需要修改類而不是樣式,只需要替換style爲class即可。

  	<?php $form = ActiveForm::begin(['action' => ['site/login'], 'method' => 'post']);?>
    	<div style='width:255px;min-height:40px;height:auto;'>
    		<label for='loginform-username' style='margin-right:10px;line-height:2.2em;float:left;'>用戶名</label>
    		<?= $form->field($model, 'username')
    			->label(false)
    			->textInput(['style' => 'float:left;width:200px;'])
    			->error(['style' => 'line-height:2.2em;']); ?>
    	</div>
    	<div style='width:255px;min-height:40px;height:auto'>
    	<label for='loginform-username' style='padding-left:13px;margin-right:10px;line-height:2.2em;float:left;'>密碼</label>
    	<?= $form->field($model, 'password')
    		->passwordInput()
    		->label(false)
    		->textInput(['style' => 'float:left;width:200px;'])
    		->error(['style' => 'line-height:2.2em;']); ?>
    	</div>
    	<div style='width:255px;min-height:20px;height:auto'>
    		<?= $form->field($model, 'rememberMe')
    		->checkBox(['style' => 'flot:left;'])
    		->label('請記住我', ['style' => 'margin-right:-35px;']); ?>
    	</div>

    	<?= Html::submitButton('登錄', ['class' => 'btn btn-primary', 'name' => 'submit-button']); ?>


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章