-
6 Aug 2012 11:57 AM #1
Unanswered: Align Text in textfield to center is being ignored.
Unanswered: Align Text in textfield to center is being ignored.
I have the following code:
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.Code:{ xtype: 'textfield', id: 'ap', name: 'ap', style: 'text-align:center;', readOnly: true }
-
7 Aug 2012 12:08 AM #2Sencha - Community Support Team
- Join Date
- May 2012
- Location
- Istanbul
- Posts
- 1,331
- Vote Rating
- 76
- Answers
- 124
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:
then, just define the css class like below:Code:inputCls: 'x-text-center',
.x-text-center{text-align:center;}sword-it.com, Sencha Developer House in Turkey - Istanbul University Technopark Suite 204.


Reply With Quote