开发者

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

开发者 https://www.devze.com 2023-01-27 19:00 出处:网络
The code: <div> <h:outputText value=\"DelivertyType: \" style=\"width:135px\"/>开发者_JAVA技巧;

The code:

<div>
  <h:outputText value="DelivertyType: " style="width:135px"/>开发者_JAVA技巧;
  <h:inputText value="#{newConsign.consign.faId}" style="width:135px"/>
</div>

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


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.


You can force it to display as a block element:

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

this works.

0

精彩评论

暂无评论...
验证码 换一张
取 消