extjs 4.2.1 - center align text in label
11,845
Thanks for all the answer guys. I figured it out:
label.setText('ABC<br/>B');
Then in your label config, you simply define the style property like this:
style: 'display:inline-block;text-align:center'
Author by
Android Noob
Updated on June 08, 2022Comments
-
Android Noob about 2 years
I have a Ext.form.Label component in ExtJS. In the label I have 2 lines of text. How do I horizontally center both of these lines of text? For example:
ABC B
I tried putting
span
tags around each line and styling them withtext-align:center
but both of the text are still left aligned.EDIT: added some code:
label.update('<span>ABC</span><br>'+ '<span>B</span>');