Results 1 to 2 of 2

Thread: Align Text in textfield to center is being ignored.

  1. #1
    Sencha User LoneWolfPR's Avatar
    Join Date
    Aug 2012
    Posts
    34
    Answers
    1
    Vote Rating
    0
      0  

    Default Unanswered: Align Text in textfield to center is being ignored.

    I have the following code:
    Code:
    {
    xtype: 'textfield',
    id: 'ap',
    name: 'ap',
    style: 'text-align:center;',
    readOnly: true
    }
    For some reason though, the text in the field does not come up as aligned center. It shows up aligned to the left. When I look in chrome at the Generated Style I see it ignoring a couple calls to center in favor of setting the property to 'text-align: start;' This is coming from '-webkit-autouser agent stylesheet'. Why would it use a browser default and not even insert the style I specified? An inspection of the element itself shows that the specified style isn't even inserted inline like it's supposed to be.

  2. #2
    Sencha User sword-it's Avatar
    Join Date
    May 2012
    Location
    Istanbul
    Posts
    1,335
    Answers
    124
    Vote Rating
    91
      0  

    Default

    Hi,
    To align the textfield text into the center, you should use the 'inputCls' config of the textfield. Just all this config to your textfield & define the given class in css section. Review the following code:

    Code:
       inputCls: 'x-text-center',
    then, just define the css class like below:
    .x-text-center{text-align:center;}
    sword-it.com, Sencha Developer House in Turkey - Istanbul University Technopark Suite 204.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •