Brian J Brian J - 1 month ago 6
CSS Question

How to wrap comma separated string onto new line in td cell?

I've one column in a table that contains comma separated emails in each cell of that column.

So for example a cell may contain the following and cell displays email inline. Instead of breaking the second email onto a newline:,


How can you wrap comma separated strings onto new line in td cell?

What I've tried:

I can't statically set a
between the emails as they are being read back from a database dynamically.

I did also try adding a span within the td and applying a custom CSS style
. But this style doesn't display the emails stacked as expected in the cell:

CSS style:

span.wrap-emails {


Cell definition:

<td><span class="wrap-emails">@row.Contact_Emails</span></td>


You should be able to replace the commas with brs using the following in your razor:


The Html.Raw bit is so that it renders the br instead of encoding it