身体的gwt 2.7.0背景图像

时间:2016-01-14 15:22:52

标签: css gwt uibinder resourcebundle

我希望我的登录页面在正文中有背景图像。这是我到目前为止所做的:

public interface MyResources extends ClientBundle {
    public static final MyResources INSTANCE = GWT.create(MyResources.class);

    @Source("css/login.css")
    public MyLoginCssResource loginCss();

    @Source("css/GWT_App.css")
    public CommonCss commonCss();

    @Source("img/logo.png")
    @ImageOptions(repeatStyle = RepeatStyle.Both)
    ImageResource backgroundImage();
}

public interface CommonCss extends CssResource {

    String body();
}

.body {
    background-color: white;
    gwt-image: 'backgroundImage';
}

如果我已经引用了loginCss,如何在我的ui.xml文件中引用commonCSS?

<ui:with field='res' type='client.resources.MyResources' />

<g:HTMLPanel addStyleNames="{res.loginCss.maindiv}">
</g:HTMLPanel>
</ui:UIBinder>

以及如何在ui.xml文件中为body标签设置样式?

1 个答案:

答案 0 :(得分:1)

  

如果我已经引用了loginCss,如何在我的ui.xml文件中引用commonCSS?

<g:HTMLPanel addStyleNames="{res.loginCss.maindiv} {res.commonCss.body}"/>
  

以及如何在ui.xml文件中为body标签设置样式?

据我所知,你无法从ui.xml文件访问body。 只有几种方法可以在登录页面中显示此背景。 最简单的方法是将所有页面包装在容器块中

    <g:FlowPanel addStyleNames="{res.commonCss.body}">
       <g:HTMLPanel addStyleNames="{res.loginCss.maindiv} "/>
   </g:FlowPanel>

因此,在登录页面的导航中 - 背景不会停留在那里。

如果你想要一个永久效果 - 你可以在index.html文件中添加css,作为body标签的常规css

相关问题