JSF myfaces dataTable,如何避免NBSP; TD中的标签

时间:2011-01-07 13:25:07

标签: html jsf alignment myfaces html-table

我的样式应用于myfaces应用程序的dataTable的TD元素。

td.financialReportTd {
    font-family: Arial;
    font-size: 12px;
    line-height: 12px;
    color:black;
    background-color: white;
        padding-right: 5px;
    text-align: right;
    border:0px black solid;
    height: 30px;
    padding-top:4px;
    padding-left:4px;
    vertical-align: top;
    direction: rtl;
}

输出:

<td class="financialReportTd">
    &nbsp;&nbsp;&nbsp;&nbsp;         
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;          

    &nbsp;&nbsp;&nbsp;&nbsp;MY TEXT
</td>

无论我尝试什么,这些NBSP标签都会填满TD并且文本的位置变得更糟。

我尝试了样式text-align:right; (我需要RTL文本),我尝试了方向:rtl;什么都没有帮助。

如何将文本与TD的右侧对齐并避免使用这些空格标记?

2 个答案:

答案 0 :(得分:0)

您是否100%确定nbsps不在数据库中(或您使用的任何数据源)?他们本可以通过事故(或从excel或其他地方转换)到达那里;这比JSF中的这种错误更可能。

答案 1 :(得分:0)

<h:column>
  ></h:panelGrid>
</h:column>

要消除NBSP,我们需要将outputText包装到panelGrid中,加上(非常重要!)应该没有sp快乐:)