I have html tables that I want to display newlines in because of the amount of potential text users can add. Setting <td>
s with style="white-space:pre-line"
causes the table to display newlines, just like I want.
However, it also adds a bunch of padding in the cell that I do NOT want. What is the correct way to eliminate this extra padding (where it would be the same as the example shown for style="white-space:normal"
) but still recognize newlines?
Bootstrap is being used.
<td>
s with style="white-space:pre-line"
. Note extra padding within cell. This adds up to lots of wasted screen real estate.
<td>
with style="white-space:normal"
. More compact (good), but does not display newlines in table cells.
<div class="table-responsive" id="">
<table class="table table-hover table-condensed">
<thead>
<tr>
@for (int j = 0; j < Model.Tables[i].TableRows[0].TableCells.Count(); j++)
{
<th class="header">Column Name</th>
}
</tr>
</thead>
<tbody class="list">
@for (int k = 1; k <= Model.Tables[i].TableRows.Count() - 1; k++)
{
<tr>
@for (int l = 0; l < Model.Tables[i].TableRows[k].TableCells.Count(); l++)
{
<td class="" style="white-space:pre-line;">
<a href="#EditTableCellModal">Cell Text </a>
</td>
}
</tr>
}
</tbody>
</table>
</div>