I have a problem with the <pre> inside the <td> . I have a JSF datatable and three columns. I need all three columns to contain preformatted text.
If I use the <pre> , the text appears as pre-formatted, but the width of the columns becomes much larger than the text.
I can solve this in css by specifying a white-space: pre-line; tag style white-space: pre-line; in <pre> . But it only works with firefox and IE, chrome ignores this style.
So my question is: is there a possible way to solve the width of the <td> that contains the <pre> inside?
Edition:
My css class:
.dt_row { height: 8px; margin: 3px 3px 3px 3px; color: #000000; white-space: pre-line; }
And my datatable:
<h:dataTable value="#{searchBean.searchResult.concordances}" var="concordance"> <h:column> <pre class="dt_row"> #{concordance.left} </pre> </h:column> <h:column> <pre class="dt_row" style="color: blue;"> #{concordance.middle} </pre> </h:column> <h:column> <pre class="dt_row"> #{concordance.right} </pre> </h:column> </h:dataTable>
Edition:
I have found a solution. Instead of the <pre> I used <code> , and now all the data is displayed perfectly.
source share