EditorFor&安培; DisplayNameFor内消旋horizental将太靠近彼此 [英] EditorFor & DisplayNameFor inside dl-horizental will be too close to each other
本文介绍了EditorFor&安培; DisplayNameFor内消旋horizental将太靠近彼此的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有我的asp.net的MVC的Razor视图里面以下code和我使用引导3: -
< DL类=DL-水平>
< DT>
@ Html.DisplayNameFor(型号=> model.Name)
< / DT> < DD>
@ Html.EditorFor(型号=> model.Name,新{htmlAttributes = {新@class =表格控,禁用=禁用}})
< / DD> < DT>
@ Html.DisplayNameFor(型号=> model.Description)
< / DT> < DD>
@ Html.TextAreaFor(型号=> model.Description,新{@class =表格控,禁用=禁用})
< / DD>
其结果是,所有的editorfor将太靠近彼此如下: -
所以任何人都可以书于如何增加项目之间有一些垂直空间?
解决方案
环绕你的投入在表单组
div的,这将使他们的保证金有点底部
\r
\r\r
\r <链接HREF =https://maxcdn.bootstrapcdn.com/bootstrap /3.3.2/css/bootstrap.min.css的rel =stylesheet属性/>\r
&所述; SCRIPT SRC =https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js>&下; /脚本>\r
&所述; SCRIPT SRC =https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/js/bootstrap.min.js>&下; /脚本>\r
\r
< DL类=DL-水平>\r
< DT>&DD1 LT; / DT>\r
< DD>< DIV CLASS =表单组><输入类型=文本级=表格控/>< / DIV>< / DD>\r
< DT>&DD2 LT; / DT>\r
< DD>< DIV CLASS =表单组><输入类型=文本级=表格控/>< / DIV>< / DD>\r
< DT> DD3< / DT>\r
< DD>< DIV CLASS =表单组><输入类型=文本级=表格控/>< / DIV>< / DD>\r
< / DL>
\r
i have the following code inside my asp.net mvc Razor view, and i am using Bootstrap 3:-
<dl class="dl-horizontal">
<dt>
@Html.DisplayNameFor(model => model.Name)
</dt>
<dd>
@Html.EditorFor(model => model.Name,new { htmlAttributes = new { @class = "form-control", disabled = "disabled" } })
</dd>
<dt>
@Html.DisplayNameFor(model => model.Description)
</dt>
<dd>
@Html.TextAreaFor(model => model.Description,new { @class = "form-control", disabled = "disabled" } )
</dd>
The result is that all the editorfor will be too close to each other as follow:-
so can anyone adivce how to add some vertical space between items?
解决方案
Wrap your inputs in form-group
divs that will give them a little bit of margin at the bottom.
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css" rel="stylesheet"/>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/js/bootstrap.min.js"></script>
<dl class="dl-horizontal">
<dt>DD1</dt>
<dd><div class="form-group"><input type="text" class="form-control" /></div></dd>
<dt>DD2</dt>
<dd><div class="form-group"><input type="text" class="form-control" /></div></dd>
<dt>DD3</dt>
<dd><div class="form-group"><input type="text" class="form-control" /></div></dd>
</dl>
这篇关于EditorFor&安培; DisplayNameFor内消旋horizental将太靠近彼此的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文