如何在使用设置文本框的宽度Html.TextBoxFor [英] How to set the width of the text box when using Html.TextBoxFor
本文介绍了如何在使用设置文本框的宽度Html.TextBoxFor的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有我的看法如下一行:
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" })%>
这篇关于如何在使用设置文本框的宽度Html.TextBoxFor的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文