如何将 jquery ui 按钮居中?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/4689890/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-26 17:44:01 来源:igfitidea点击:
How to center jquery ui buttons?
提问by Richard Knop
Adding this to CSS does not work:
将此添加到 CSS 不起作用:
.ui-dialog-buttonpane { text-align: center; }
The buttons are still on the right side.
按钮仍然在右侧。
What should I do?
我该怎么办?
回答by Richard Knop
Ok. I also needed to remove the float. This works:
好的。我还需要移除浮动。这有效:
.ui-dialog .ui-dialog-buttonpane {
text-align: center;
}
.ui-dialog .ui-dialog-buttonpane .ui-dialog-buttonset {
float: none;
}
回答by badr slaoui
In my case I also needed to add !important to the float property
就我而言,我还需要将 !important 添加到 float 属性
.ui-dialog .ui-dialog-buttonpane .ui-dialog-buttonset {
text-align: center;
float: none !important;
}