'Add line break to js table header label

I have a table with such header :

 <th key={col.label}
     style={col.size}
     class={col.class}
     scope="col"
     height="20">

I take labels from columns(col is an item of cycle). Columns is an array with such elements

this.columns.push({
   label: this.labels.lbl_forecastYTD + ' - ' + this.labels.lbl_opportunity ,
   fieldName: 'GainSum__c', 
   type: 'number',
   size: "width: 21%;", 
   class: BASE_HEADER_CLASS,
   borderRightSize: "width:  21%;"
}); 

I really want to add a line break to labels, but '\n' doesn't seem to be worked. Thanks!



Solution 1:[1]

Use th { white-space: pre; } and \n will work.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 connexo