开发者

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

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜