开发者

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:

  1. Link the stylesheet in your host.html file.

  2. 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

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜