删除GWT生成的绝对位置 [英] Remove absolute position generated by GWT

查看:116
本文介绍了删除GWT生成的绝对位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的网页中,我有一个菜单( Horizo​​ntalPanel ),应该被缓存到页面的底部。为此,我尝试使用 RootLayoutPanel 类,并在其中添加一个南部小部件,我成功地做到了。但问题是菜单不居中。
我试图添加另一个CSS(我注意到这个位置):

In my web page, I have a menu (HorizontalPanel) that should be stached to the buttom of the page. To do that, I've tried to use the RootLayoutPanel class and add a south widget in it and I succeeded to do that. but the problem is that the menu is not centered. I tried to add another CSS in which I wrote(and notice the position):

.cetrer {
    Margin-left : auto;
    margin-right: auto;
    position: relative;
}

但是当页面被重定时,位置被GWT设置为absolute。
我试图通过添加这个木马到代码强制位置,但它不工作:

But when the page is redered, the position is set to absolute by GWT. And I tried to force the position by adding this lign to the code but it didn't work:

DOM.setElementAttribute(menuBar.getElement(), "style", "position: relative;");

那么有什么解决方案?
感谢

So is there any solution to fix? Thanks

推荐答案

您尝试添加!important;
喜欢:

Have you tried adding !important; ? Like:

.cetrer {
    Margin-left : auto;
    margin-right: auto;
    position: relative !important;
}

不是最好的解决方案。

这篇关于删除GWT生成的绝对位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆