入门客AI创业平台(我带你入门,你带我飞行)
博文笔记

Yii2 Form表单样式修改

创建时间:2015-10-20 投稿人: 浏览次数:3536

以下为主要的样式修改的代码,大家可以看着修改。如需要修改类而不是样式,只需要替换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"]); ?>


声明:该文观点仅代表作者本人,入门客AI创业平台信息发布平台仅提供信息存储空间服务,如有疑问请联系rumenke@qq.com。