Twitter Bootstrap - Center Modal Dialog

Ano*_*us1 9 modal-dialog twitter-bootstrap

I'm trying to center a waiting screen modal dialog in the middle of the screen. Here is the modal dialog I'm trying to alter: http://dotnetspeak.com/2013/05/creating-simple-please-wait-dialog-with-twitter-bootstrap. How do I center it horizontally and vertically?

cra*_*att 16

这只是将一些CSS应用于pleaseWaitDialogID的问题.你必须设置position:absolute和,margin-top并且margin-left需要是高度和宽度的一半.所以你的CSS应该是这样的:

#pleaseWaitDialog {
    width: 400px;
    height: 50px;
    position: absolute;
    top: 50%;
    left: 50%;
    margin-top: -25px;
    margin-left: -200px;
    padding: 20px;
}
Run Code Online (Sandbox Code Playgroud)

你需要玩这些数字才能达到你想要的盒子大小,但这应该可以让你开始.

  • [这](http://www.abeautifulsite.net/vertically-centering-bootstrap-modals/)一个更完美! (3认同)
  • 这有效.对于具有相同问题的任何其他人,我删除了高度和位置属性,并将margin-top更改为-90px. (2认同)