Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/71.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html 如何更改剃须刀复选框以进行对齐_Html_Css_Asp.net Mvc_Razor - Fatal编程技术网

Html 如何更改剃须刀复选框以进行对齐

Html 如何更改剃须刀复选框以进行对齐,html,css,asp.net-mvc,razor,Html,Css,Asp.net Mvc,Razor,Visual Studio 2013中的标准ASP.NET MVC模板生成一个页面Register.cshtml,该页面定义了将新用户注册到系统中的UI。我对其进行了扩展,添加了“我接受条款”复选框。以下是代码片段: <div class="form-group"> @Html.LabelFor(m => m.ConfirmPassword, new { @class = "col-md-2 control-label" }) <div class="co

Visual Studio 2013中的标准ASP.NET MVC模板生成一个页面
Register.cshtml
,该页面定义了将新用户注册到系统中的UI。我对其进行了扩展,添加了“我接受条款”复选框。以下是代码片段:

<div class="form-group">
    @Html.LabelFor(m => m.ConfirmPassword, new { @class = "col-md-2 control-label" })
    <div class="col-md-10">
        @Html.PasswordFor(m => m.ConfirmPassword, new { @class = "form-control" })
    </div>
</div>
<div class="form-group">
    <div class="col-md-offset-2 col-md-10">
            @Html.CheckBoxFor(m => m.AcceptTerms, new { @class = "form-control" })
            @Html.Label("I accept", new { @class = "control-label" })
    </div>
</div>

@LabelFor(m=>m.ConfirmPassword,新的{@class=“col-md-2控制标签”})
@Html.PasswordFor(m=>m.ConfirmPassword,new{@class=“form control”})
@CheckBoxFor(m=>m.AcceptTerms,新的{@class=“form control”})
@Label(“我接受”,新的{@class=“control Label”})
这个想法是在密码编辑框下面显示一个chexkbox。文本必须显示在复选框的右侧

以下是输出外观的局部图像:

如您所见,复选框正在居中对齐,“我接受”将流向下一行

如何将复选框和标签保持在一起,并确保复选框与其上方的编辑框左对齐?问候。

请这样做

<label>
I accept

@Html.CheckBoxFor(m => m.AcceptTerms)
</label>

我接受
@CheckBoxFor(m=>m.AcceptTerms)
执行此操作

<label>
I accept

@Html.CheckBoxFor(m => m.AcceptTerms)
</label>

我接受
@CheckBoxFor(m=>m.AcceptTerms)

似乎“label”或/和
input type=“checkbox”
具有显示类型
block


要快速检查,请尝试将
style=“display:inline block”
添加到
标签和
复选框中。如果我是对的,那么您可以更正您的.css文件。

似乎“label”或/和
input type=“checkbox”
具有显示类型
block


要快速检查,请尝试将
style=“display:inline block”
添加到
标签和
复选框中。如果我是对的,那么你可以更正你的.css文件。

试试这个。。。希望这会有所帮助

<div class="checkbox">
    @Html.CheckBoxFor(model => model.IsMobileView, new { htmlAttributes = new { @class = "form-control pull-left" } })
</div>

@CheckBoxFor(model=>model.IsMobileView,new{htmlAttributes=new{@class=“formcontrol-pull-left”})

试试这个。。。希望这会有所帮助

<div class="checkbox">
    @Html.CheckBoxFor(model => model.IsMobileView, new { htmlAttributes = new { @class = "form-control pull-left" } })
</div>

@CheckBoxFor(model=>model.IsMobileView,new{htmlAttributes=new{@class=“formcontrol-pull-left”})

这是一个css问题这是一个css问题