[CLOSED] CSS Class : How to set CSS class to TextField

  1. #1

    [CLOSED] CSS Class : How to set CSS class to TextField

    I am trying to add a css class to text field.my code like bellow.but textfield not take effect

    @using Ext.Net.MVC
    
    @Html.X().ResourceManager()
    @{
        Layout = null;
    }
    
    <!DOCTYPE html>
    
    <html>
    <head>
        <meta name="viewport" content="width=device-width" />
        <title>Index</title>
        <style>
            .input {
        border: 1px solid #CCCCCC;
        font-size: 14px;
        font-weight: bold;
        width: 225px;
        height: 18px;
        margin-top: 2px;
        padding: 5px 2px 2px;
    }
        </style>
    </head>
    <body>
        <div>
            @(Html.X().TextField()
            .ID("txtUsername")
            .ReadOnly(false)
            .HideLabel(true)
            .AllowBlank(false)
            .Border(false)
            .BlankText("Your username is required.")
            .Cls("input")
    
            )
            <br />
            <input name="txtPass" type="password" id="txtPass" tabindex="3" class="input" />
        </div>
    </body>
    </html>
    Last edited by Daniil; Jan 30, 2015 at 1:33 PM. Reason: [CLOSED]
  2. #2
    Hi @matrixwebtech,

    Please clarify have you inspected HTML elements and its CSS rules? Usually, inspecting help to understand and determine what changes are required.
  3. #3
    Thanks for tips.I override default css with same class name and !important .am I follow correct technique?

    .x-form-text {
        background: none !important;
    }
  4. #4
    If you want it changed for every field, then your technique applies, although I don't think !important is necessary as long as your rule is applied last. If you only want to change some fields, then specify a Cls for those fields and use CSS like
    .my-custom-textfield-cls .x-form-text {
        background: none;
    }

Similar Threads

  1. Replies: 3
    Last Post: Feb 20, 2014, 4:24 AM
  2. [CLOSED] CSS class for disabled TextField
    By vadym.f in forum 1.x Legacy Premium Help
    Replies: 8
    Last Post: Jun 07, 2012, 5:48 PM
  3. Replies: 1
    Last Post: Apr 30, 2012, 7:34 AM
  4. Replies: 4
    Last Post: Apr 25, 2012, 11:57 AM
  5. [CLOSED] apply class to TextField
    By idrissb in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Mar 24, 2009, 9:55 AM

Posting Permissions