Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set the width of <h:outputText> of JSF2.0?

Tags:

jsf-2

The code:

<div>
  <h:outputText value="DelivertyType: " style="width:135px"/>
  <h:inputText value="#{newConsign.consign.faId}" style="width:135px"/>
</div>

The style="width:135px" for h:outputText doesn't work.

like image 359
Keating Avatar asked Nov 30 '10 07:11

Keating


2 Answers

You can force it to display as a block element:

<h:outputText value="DelivertyType: " style="display:block;width:135px"/>

this works.

like image 88
Bruno_Condemi Avatar answered Sep 25 '22 14:09

Bruno_Condemi


The outputText will generate the a span like this :

<span style="width: 135px;">DelivertyType:</span>

The "width" attribute cannot be applied on in-line elements like SPAN. (can only be applied to block-style elements).

Try wrapping the outputText in a div, and apply the styling on the DIV.

like image 36
ddewaele Avatar answered Sep 28 '22 14:09

ddewaele