Javascript 引导不正确的表单格式
我将引导表单类从Javascript 引导不正确的表单格式,javascript,jquery,html,css,twitter-bootstrap,Javascript,Jquery,Html,Css,Twitter Bootstrap,我将引导表单类从表单水平更改为表单内联,所有格式都被破坏。如何获得正确的内联格式 之前 内联后 这是带有第一个表单字段的示例代码 <div class="form-horizontal"> <hr /> @Html.ValidationSummary(true, "", new { @class = "text-danger" }) <div class="form-group"> <label class=
表单水平
更改为表单内联
,所有格式都被破坏。如何获得正确的内联格式
之前
内联后
这是带有第一个表单字段的示例代码
<div class="form-horizontal">
<hr />
@Html.ValidationSummary(true, "", new { @class = "text-danger" })
<div class="form-group">
<label class="control-label col-md-2" for="Med_Name">Medicine Name</label>
<div class="col-md-10">
@Html.EditorFor(model => model.Med_Name, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.Med_Name, "", new { @class = "text-danger" })
</div>
</div>
@* Rest Of The HTML Code Is Not Shown *@
@Html.ValidationSummary(true,“,new{@class=“text danger”})
药名
@EditorFor(model=>model.Med_Name,new{htmlAttributes=new{@class=“form control”}})
@Html.ValidationMessageFor(model=>model.Med_Name,“,new{@class=“text danger”})
@*HTML代码的其余部分未显示*@
当您将样式设置为内联时
您还需要将其包装到相应的UI模式中,例如。。将前3个文本框
包装在col-md-4
中,然后将所有这3个文本框
包装在col-md-12
中作为它们的父项。。或者,您甚至可以尝试为每3个文本框
或根据您的要求将其包装在行
元素中
Ex:
<div class="col-md-12"> <!--Even row instead of col-md-12-->
<div class="form-group col-md-4"> <!--col-md-4 for other elements too-->
<label class="control-label col-md-2" for="Med_Name">Trade Price</label>
<div class="col-md-10">
@Html.EditorFor(model => model.Med_Name, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.Med_Name, "", new { @class = "text-danger" })
</div>
</div>
<!--Same goes for other 2 elements-->
</div>
<div class="col-md-12"> <!--Even row instead of col-md-12-->
<div class="form-group col-md-4">
<label class="control-label col-md-2" for="Med_Name">Medicine Name</label>
<div class="col-md-10">
@Html.EditorFor(model => model.Med_Name, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.Med_Name, "", new { @class = "text-danger" })
</div>
</div>
<!--Same goes for other 2 elements-->
</div>
交易价格
@EditorFor(model=>model.Med_Name,new{htmlAttributes=new{@class=“form control”}})
@Html.ValidationMessageFor(model=>model.Med_Name,“,new{@class=“text danger”})
药名
@EditorFor(model=>model.Med_Name,new{htmlAttributes=new{@class=“form control”}})
@Html.ValidationMessageFor(model=>model.Med_Name,“,new{@class=“text danger”})
您可以分享您的HTML吗?请参阅。。当您设置inline
时,请根据您的需要尝试使用适当的col md-*
类包装:)当然@AliJamal我会提供一些细节:)