0

I have a an outputlable <h:outputLabel id="label1" value="Project Name"/>.Next to that I have another <h:outputLabel id="label2" value="#{XXBean.details.projectName}"/>
Both labes are located inside a <p:fieldset>
label2 will get rendered based on the value in bean. label2 is getting wrapped in the next line but the wrapped text should start from the starting index of the label2 not from starting index of label1.

I tried <h:outputLabel style="white-space: pre;word-wrap: break-word;" />
but it shows the label2 in a straight line and its extending the size of the fieldset. And its not wrapping it as per the expected results given below.

Actual result I am getting : label1:labellabel2label2label2label2label2label2label2label2label2 label2label2label2label2 Expected : label1:labellabel2label2label2label2label2label2label2label2label2 label2label2label2label2 

Please advise me to get the Expected output.

3
  • That might depend on the width, you are giving to your labels through wrapper. Commented Jan 8, 2014 at 14:16
  • I am not providing any width to the label2 as you can see above.<h:outputLabel id="label2" value="#{XXBean.details.projectName}"/> Commented Jan 8, 2014 at 14:24
  • But where are you wrapping your two lables? I mean to ask that you should put them in separate divs or spans. Commented Jan 8, 2014 at 14:32

1 Answer 1

1

the first label has a fix width (its only "Project Name" value) and the second one depend on the width from labels wrapper (e.g. fieldset).

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

Set correct label2 width depends from the wrapper.

Alternative: Display labels as a table cell.

#label1{ display: table-cell; vertical-align: top; } #label2{ display: table-cell; } 
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.