---
title: "asp.net-mvc How to change width @Html.TextBox"  
description: "asp.net-mvc How to change width @Html.TextBox"  
author: "Anonymous User"  
published: 2013-09-28  
updated: 2013-09-28  
canonical: https://www.mindstick.com/forum/1552/asp-dot-net-mvc-how-to-change-width-html-textbox  
category: "asp.net mvc"  
tags: ["asp.net mvc"]  
reading_time: 2 minutes  

---

# asp.net-mvc How to change width @Html.TextBox

how do you change the width of a [textbox](https://www.mindstick.com/forum/12714/dynamic-textbox-in-gridview) in an [asp.net](https://www.mindstick.com/articles/934/default-folders-available-inside-the-asp-dot-net-application-folder)-[mvc](https://www.mindstick.com/forum/155803/define-cache-profile-in-mvc) [View](https://yourviews.mindstick.com/view/84701/layoffs-in-google-india-2023-view)

i want to have these [fields](https://www.mindstick.com/forum/159126/sql-query-for-all-tables-and-fields-in-an-oracle-db) [side by side](https://www.mindstick.com/forum/12815/display-two-fields-side-by-side-in-a-bootstrap-form) and the state textbox much shorter width

```
    <p>
                <label for="city">City:</label>
                @Html. TextBoxFor("city")
                <label for="state">State:</label>
                @Html. TextBoxFor("state")
            </p>
```

EDIT:

none of the below [answers](https://www.mindstick.com/forum/156899/salesforce-marketing-cloud-interview-questions-answers) seem to work for me. I noticed that in site.css i see this:

```
fieldset p
{
     margin: 2px 12px 10px 10px;
}

fieldset label
{
     display: block;
}

fieldset label.inline
{
     display: inline;
}

legend
{
     font-size: 1.1em;
     font-weight: 600;
     padding: 2px 4px 8px 4px;
}

input[type="text"]
{
    width: 200px;
    border: 1px solid #CCC;
}

input[type="password"]
{
    width: 200px;
    border: 1px solid #CCC;
}
```

how do i override this [behavior](https://www.mindstick.com/forum/159354/runtimeexception-and-exception-behavior) for one [field](https://www.mindstick.com/forum/160867/does-mindstick-provide-training-for-field-marketing) (textbox)

## Replies

### Reply by Anonymous User

Hey Tanuja!

Here I would use the helper signature which is takes HTML attributes and assign it a CSS class. You would then use CSS to achieve the desired look and feel.

```
 @Html.TextBoxFor( "state", null, new { @class = "small-input" } )
```


---

Original Source: https://www.mindstick.com/forum/1552/asp-dot-net-mvc-how-to-change-width-html-textbox

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
