删除GWT生成的绝对位置 [英] Remove absolute position generated by GWT
问题描述
在我的网页中,我有一个菜单( HorizontalPanel
),应该被缓存到页面的底部。为此,我尝试使用 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屋!