html - Razor View 中的垂直对齐

标签 html css razor

我有这个片段:

<p>
@Html.LabelFor(m => m.address, new { style="vertical-align: middle;" }) @Html.TextAreaFor(m => m.address, new { @class = "addition ", value = "",rows="4", required = "required" })
 </p>

我得到这个结果:

result

我需要把标签放在中间。 我怎样才能更改上面的代码来完成这个任务?

最佳答案

也将 vertical-align:middle 添加到文本区域。

    <p>
           @Html.LabelFor(m => m.Address, new { style = "vertical-align: middle;" })
           @Html.TextAreaFor(m => m.Address, new { @class = "addition ", style = "vertical-align: middle;", value = "", rows = "4", required = "required" })
    </p>

关于html - Razor View 中的垂直对齐,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37098926/

相关文章:

html - 在 Web 检查器中找不到元素

asp.net-mvc - 获得 MVC Razor 青睐 .cshtml 而不是 .aspx

html - 将现有菜单转换为响应式菜单

javascript - Handlebars 模板和 bxSlider

javascript - typescript 错误 "Property ' 值'在类型 'HTMLElement' 上不存在”, "Property ' onclick'在类型 'Element' 上不存在”

c# - 来自另一个程序集的 Razor 布局

c# - 使用epplus创建.xlsm文件

css - 如何使固定的 BG 图片溢出父 DIV?

html - 对所有 div 应用 clearfix 以防止容器崩溃

html - 在 div 中居中文本