MVC 5 Boostrap复选框CSS问题
我有一个登记表,但复选框不会显示。输入字段有占位符,我希望文本显示在复选框的左侧,文本与页面上的所有占位符对齐 到目前为止,我要么在复选框上方有文本(它在标签上居中),要么在下方。下面是我的注册页面和相关CSS。我想不出来,请帮忙 Register.cshtmlMVC 5 Boostrap复选框CSS问题,css,html,asp.net-mvc-5,Css,Html,Asp.net Mvc 5,我有一个登记表,但复选框不会显示。输入字段有占位符,我希望文本显示在复选框的左侧,文本与页面上的所有占位符对齐 到目前为止,我要么在复选框上方有文本(它在标签上居中),要么在下方。下面是我的注册页面和相关CSS。我想不出来,请帮忙 Register.cshtml <div class="row"> <article class="span7"> <section class="block-indent-1 maxheight">
<div class="row">
<article class="span7">
<section class="block-indent-1 maxheight">
<h2>@ViewBag.Title.</h2>
<p>Please take care when entering your details as they will determine your access and operation of this website.</p>
<p>Please note that all fields marked with an asterisk * must be completed in order for you to become a registered user.</p>
</section>
</article>
<article class="span5">
<section class="block-indent-1 divider-left maxheight">
<h2>Sign Up Here</h2>
@using (Html.BeginForm("Register", "Account", FormMethod.Post, new { @id = "contact-form", role = "form" }))
{
@Html.AntiForgeryToken()
@Html.ValidationSummary("", new { @class = "text-danger" })
<fieldset>
<div class="form-div-5">
<label>
@Html.DropDownListFor(model => model.TitleId, TitleModel.TitleList)
</label>
</div>
<div class="form-div-5">
<label>
@Html.DropDownListFor(model => model.SexId, SexModel.SexList)
</label>
</div>
<div class="form-div-5">
<label>
@Html.TextBoxFor(m => m.Forename, new { @placeholder = "Forename *", @type = "text", required = "required" })
</label>
</div>
<div class="form-div-5">
<label>
@Html.TextBoxFor(m => m.Surname, new { @placeholder = "Surname *", @type = "text", required = "required" })
</label>
</div>
<div class="form-div-5">
<label>
@Html.TextBoxFor(m => m.Email, new { @placeholder = "Email Address *", @type = "email", required = "required" })
</label>
</div>
<div class="form-div-5">
<label>
@Html.TextBoxFor(m => m.UserName, new { @placeholder = "Username *", @type = "text", @pattern = "[a-zA-Z0-9]{6,}", @title = "Your username must have no spaces or special characters and must be at least 6 characters long.", required = "required" })
</label>
</div>
<div class="form-div-5">
<label>
@Html.PasswordFor(m => m.Password, new { @placeholder = "Password *", @type = "password", required = "required" })
</label>
</div>
<div class="form-div-5">
<label>
@Html.PasswordFor(m => m.ConfirmPassword, new { @placeholder = "Confirm Password *", @type = "password", required = "required" })
</label>
</div>
<div class="form-div-5">
<label class="checkbox-inline">
@Html.CheckBoxFor(m => m.AcceptsTerms) @Html.LabelFor(m => m.AcceptsTerms)
</label>
</div>
<div class="button-wrapper">
<input type="submit" class="button" value="Register" /> <input type="reset" value="Reset" name="MFReset" class="button"><span>* Required Fields</span>
</div>
</fieldset>
}
</section>
</article>
</div>
任何帮助都将不胜感激:-)尝试使用
displayname for
而不是LabelFor
,因为您已经有了包装标签
<label class="checkbox-inline">
@Html.CheckBoxFor(m => m.AcceptsTerms) @Html.DisplayNameFor(m => m.AcceptsTerms)
</label>
@Html.CheckBoxFor(m=>m.AcceptsTerms)@Html.DisplayNameFor(m=>m.AcceptsTerms)
谢谢
<label class="checkbox-inline">
@Html.CheckBoxFor(m => m.AcceptsTerms) @Html.DisplayNameFor(m => m.AcceptsTerms)
</label>