MVC 2 - text box width (size)

Hi,

I am specifying the size but the textbox is still getting the default size. How can i fix this?

[FONT=Consolas][SIZE=2][FONT=Consolas][SIZE=2]
<%[/SIZE][/FONT][/SIZE][/FONT][FONT=Consolas][SIZE=2][COLOR=#0000ff][FONT=Consolas][SIZE=2][COLOR=#0000ff][FONT=Consolas][SIZE=2][COLOR=#0000ff]=[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Consolas][SIZE=2][FONT=Consolas][SIZE=2] Html.TextBoxFor(model => model.EnvelopeID, [/SIZE][/FONT][/SIZE][/FONT][FONT=Consolas][SIZE=2][COLOR=#0000ff][FONT=Consolas][SIZE=2][COLOR=#0000ff][FONT=Consolas][SIZE=2][COLOR=#0000ff]new[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Consolas][SIZE=2][FONT=Consolas][SIZE=2] { maxlength = [/SIZE][/FONT][/SIZE][/FONT][FONT=Consolas][SIZE=2][COLOR=#a31515][FONT=Consolas][SIZE=2][COLOR=#a31515][FONT=Consolas][SIZE=2][COLOR=#a31515]"8"[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Consolas][SIZE=2][FONT=Consolas][SIZE=2], size = [/SIZE][/FONT][/SIZE][/FONT][FONT=Consolas][SIZE=2][COLOR=#a31515][FONT=Consolas][SIZE=2][COLOR=#a31515][FONT=Consolas][SIZE=2][COLOR=#a31515]"4"[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Consolas][SIZE=2][FONT=Consolas][SIZE=2] })%>
[/SIZE][/FONT][/SIZE][/FONT]

html


 [COLOR=#0000ff]<[/COLOR][COLOR=#800000]input[/COLOR][COLOR=#0000ff] [/COLOR][COLOR=#ff0000]id[/COLOR][COLOR=#0000ff]="EnvelopeID" [/COLOR][COLOR=#ff0000]maxlength[/COLOR][COLOR=#0000ff]="8" [/COLOR][COLOR=#ff0000]name[/COLOR][COLOR=#0000ff]="EnvelopeID" [/COLOR][COLOR=#ff0000]size[/COLOR][COLOR=#0000ff]="4" [/COLOR][COLOR=#ff0000]type[/COLOR][COLOR=#0000ff]="text" [/COLOR][COLOR=#ff0000]value[/COLOR][COLOR=#0000ff]="" />[/COLOR]

Yes, it would. =)

Different text boxes have different widths. This solution will make create a class for all the widths.

Try encapsulating things into a css class.


 
new { class = "myTextBox" }
 

And in your css file.

.myTextBox
{
width : 40px; // example only, play with the size.
}