EditorFor&安培; DisplayNameFor内消旋horizental将太靠近彼此 [英] EditorFor & DisplayNameFor inside dl-horizental will be too close to each other

查看:240
本文介绍了EditorFor&安培; DisplayNameFor内消旋horizental将太靠近彼此的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有我的asp.net的MVC的Razor视图里面以下code和我使用引导3: -

 < D​​L类=DL-水平>
        < D​​T>
            @ Html.DisplayNameFor(型号=> model.Name)
        < / DT>        < D​​D>
            @ Html.EditorFor(型号=> model.Name,新{htmlAttributes = {新@class =表格控,禁用=禁用}})
        < / DD>        < D​​T>
            @ Html.DisplayNameFor(型号=> model.Description)
        < / DT>        < D​​D>
            @ Html.TextAreaFor(型号=> model.Description,新{@class =表格控,禁用=禁用})
        < / DD>

其结果是,所有的editorfor将太靠近彼此如下: -


所以任何人都可以书于如何增加项目之间有一些垂直空间?


解决方案

环绕你的投入在表单组 div的,这将使他们的保证金有点底部

\r
\r

<链接HREF =htt​​ps://maxcdn.bootstrapcdn.com/bootstrap /3.3.2/css/bootstrap.min.css的rel =stylesheet属性/>\r
&所述; SCRIPT SRC =htt​​ps://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js>&下; /脚本>\r
&所述; SCRIPT SRC =htt​​ps://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/js/bootstrap.min.js>&下; /脚本>\r
\r
< D​​L类=DL-水平>\r
  < D​​T>&DD1 LT; / DT>\r
    < D​​D>< D​​IV CLASS =表单组><输入类型=文本级=表格控/>< / DIV>< / DD>\r
  < D​​T>&DD2 LT; / DT>\r
  < D​​D>< D​​IV CLASS =表单组><输入类型=文本级=表格控/>< / DIV>< / DD>\r
  < D​​T> DD3< / DT>\r
  < D​​D>< D​​IV CLASS =表单组><输入类型=文本级=表格控/>< / DIV>< / DD>\r
< / DL>

\r

\r
\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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆