GWT HTMLPanel Height Issue
I am using GWT HtmlPanel to group the widgets. I want to set the height for the HtmlPanel as 100% using CSS. and set the background-color to it.
Here it is my code:
CSS: .loginhtmlpan { width: 100%; height: 100%; background-color: #424242; }
please help me in this cont开发者_JAVA技巧ext.
Try using constraint-based CSS positioning rather than specifying specific heights and widths programmatically. This is becoming common practice for standard GWT-widgets. A style like:
.myCssStyle { position: absolute; top: 0; left: 0; right: 0; bottom: 0; }
You can then add this style to your HTMLPanel using the addStyleName("myCssStyle") - the nice thing about this is that proper resizing of your HTMLPanel will occur for free when browser resize events occur. As a side note, most GWT "Layout" containers use constraint-based positioning (DockLayoutPanel, LayoutPanel, SplitLayoutPanel, etc).
The simplest way to apply a css style to a gwt widget:
Link the stylesheet in your host.html file.
call
myHtmlPanel.addStyleName("loginhtmlplan")
when you create the html panel
See http://google-web-toolkit.googlecode.com/svn/javadoc/2.3/com/google/gwt/user/client/ui/UIObject.html for more details
精彩评论