Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7996665
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T14:45:50+00:00 2026-06-04T14:45:50+00:00

I know this post is probably identical to many others (for example How to

  • 0

I know this post is probably identical to many others (for example How to set the width of the text box when using Html.TextBoxFor) but I am having real trouble assigning a CSS class to a textbox.

My CSS is simple:

.myInput {
         width: 12em;
        border-color: red;   
    }

And my textbox is declared using:

@Html.TextBoxFor(model => model.DepostAmount, new {@class= "myInput"})

However the textbox is not styled any differently. Looking at the source of the page, I can see that the class is indeed included within the objects markup:

<input class="myInput" id="DepostAmount" name="DepostAmount" type="text" value="" />

I can also see the CSS for .myInput is being rendered too.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T14:45:51+00:00Added an answer on June 4, 2026 at 2:45 pm

    I figured it out. In the sample application generated by visual studio, there was a selector selecting all inputs which was overriding my own css class.

    input[type="text"], 
    input[type="password"] {
        border: 1px solid #ccc;
        padding: 2px;
        font-size: 1.2em;
        color: #444;
        width: 200px;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Update: Originally, this post was using Books as the example entity, with Books1 ,
I know there is this post , but I still want to know more
This is my first post. I know this topic has been discussed before in
I've seen this post: NSString: newline escape in plist but I'd like to know
I didn't know how to phrase the title of this post. This is what
( I don't know whether should I also post this question to ServerFault, since
I know this is probably a question that is asked a ton on here
i know this question was probably asked 1 million times, but for the 1.000.001
I know this probably must be a newbie question, but since I don't know
( I know this is probably a simple question to answer, but I don't

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.