如何在使用设置文本框的宽度Html.TextBoxFor宽度、文本框、如何在、TextBoxFor

2023-09-03 09:09:00 作者:枫叶飞丹后

我有我的看法如下一行:

I have the following line in my view:

<div class="editor-field">
     <%= Html.TextBoxFor(m => m.Description)%>                    
</div>

我如何定义文本框的宽度?

How do I define the width of the text box?

推荐答案

一个可重复使用的解决方案是设置宽度在CSS文件

A reusable solution is to set the width in your css file

.wide
{
     width: 300px;
}

然后将其设置使用上述

then set it using the markup above

<%= Html.TextBoxFor(m => m.Description, new { @class= "wide" })%>