css - gwt 2.7.0 body 背景图像

标签 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 标签设置样式?

最佳答案

How do I reference the commonCSS in my ui.xml-file if I already have the loginCss referenced?

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

and also, how can I set a style for the body tag in a ui.xml-file?

据我所知,您无法从 ui.xml 文件访问正文。 有几种方法可以仅在登录页面中使用此背景。 最简单的就是将所有页面包裹在一个容器 block 中

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

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

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

关于css - gwt 2.7.0 body 背景图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34793198/

相关文章:

html - 仅在特定类下更改特定元素

java - SmartGWT TextField 更改插入符号位置

css - GWT UiBinder 不加载样式表

java - 在 GWT 中移动元素映射的视口(viewport)?

java - 在单个 GWT Presenter 中显示两个 UI.XML 的内容

javascript - jQuery Mobile 在点击时刷新当前页面

html - 将多种ttf字体添加到HTML2PDF并通过css在它们之间切换

c# - .net 滑入式菜单

google-app-engine - GAE 上的 JDO - @Unowned 字段返回为 null

java - GWT flextable 为每列设置不同的宽度