extjs 4.2.1 - center align text in label
css, extjs, html, javascript
Solution
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'
Problem
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 with `text-align:center` but both of the text are still left aligned. EDIT: added some code: ``` label.update('<span>ABC</span><br>'+ '<span>B</span>'); ```