I suggest you use a wrapper div or paragraph:
<td><p style="width:50%;">Text only allowed to extend 50% of the cell.</p></td>
And you can make a class out of it:
<td class="linebreak"><p>Text only allowed to extend 50% of the cell.</p></td>
td.linebreak p {
width: 50%;
}
All of this assuming that you meant 50% as in 50% of the cell.
You could put the text into a div (or other container) with a width of 50%.
Try using
<table border="1" cellspacing="0" cellpadding="0" class="template-table"
style="table-layout: fixed; width: 100%">
as table style along with
<td style="word-break:break-word">long text</td>
for td it works for normal/real scenario text with words, not for random typed letters without gaps
It's hard to answer you without the HTML, but in general you can put:
style="width: 50%;"
On either the table cell, or place a div inside the table cell, and put the style on that.
But one problem is "50% of what?" It's 50% of the parent element which may not be what you want.
Post a copy of your HTML and maybe you'll get a better answer.
Source: Stackoverflow.com