簡體   English   中英

JSF包裝 <h:outputLabel> 文本wrt到下一行的起始索引

[英]JSF wrapping the <h:outputLabel> text w.r.t to starting index of the its own in next line

我有一個outputlable <h:outputLabel id="label1" value="Project Name"/> outputLabel <h:outputLabel id="label1" value="Project Name"/><h:outputLabel id="label2" value="#{XXBean.details.projectName}"/>還有另一個<h:outputLabel id="label2" value="#{XXBean.details.projectName}"/>
兩個標簽都位於<p:fieldset>
label2將根據bean中的值進行渲染。 label2正在換行,但換行后的文本應從label2的起始索引開始,而不是從label1的起始索引開始。

我嘗試了<h:outputLabel style="white-space: pre;word-wrap: break-word;" /> <h:outputLabel style="white-space: pre;word-wrap: break-word;" />
但它顯示的是label2的直線,並且其擴展了字段集的大小。 並且它沒有按照下面給出的預期結果包裝它。

Actual result I am getting : 

 label1:labellabel2label2label2label2label2label2label2label2label2
 label2label2label2label2

Expected :

label1:labellabel2label2label2label2label2label2label2label2label2
       label2label2label2label2

請建議我得到預期的輸出。

第一個標簽具有固定寬度(僅其“項目名稱”值),第二個標簽取決於標簽包裝器的寬度(例如,字段集)。

#label1{
    display: inline-block;
    vertical-align: top;
}
#label2{
    display: inline-block;
    width: 66%;
}

設置正確的label2寬度取決於包裝器。

替代方法:將標簽顯示為表格單元格。

#label1{
    display: table-cell;
    vertical-align: top;
}
#label2{
    display: table-cell;
}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM