This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
The moose likes JSF and the fly likes h:panelGrid empty space in cells Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "h:panelGrid empty space in cells" Watch "h:panelGrid empty space in cells" New topic
Author

h:panelGrid empty space in cells

Matej Mrakic
Greenhorn

Joined: Nov 23, 2011
Posts: 1
Can somebody please explain why I get empty space in cells?

<ui:composition>
<h:panelGrid columns="2" border="1" width="100%" cellpadding="0" cellspacing="0">
<h:outputText value="Message" style="width: 100%"></h:outputText>
<h:inputTextarea rows="2"/>
<h:outputText value="URL" style="width: 100%;" ></h:outputText>
<h:inputText style="width: 100%;" />
<h:panelGroup > </h:panelGroup>
<h:commandButton value="Send" style="background-color:#1056c6;color: white;font-weight: bold;"/>
</h:panelGrid>
</ui:composition>



.css

textarea {
resize: none;
text-align: left;
margin-bottom: 10px;
margin-left: 0;
margin-right: 0;
width: 100%;
}



[Thumbnail for Table.jpg]

Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16022
    
  20

Welcome to the JavaRanch, Matej!

The width CSS style attribute doesn't work on outputText, since outputText renders with the style attached to a span element, and width doesn't work with span. You'll do better using the columnClasses attribute on the panelGrid itself.

As yo why the spacing, I can only venture a guess that given so much free space to play with, the table renderer decided that that was a good column width in the absence of anything more explicit.


Customer surveys are for companies who didn't pay proper attention to begin with.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: h:panelGrid empty space in cells