相关疑难解决方法(0)

如何为所有浏览器垂直居中div?

我想div用CSS垂直居中.我不想要表或JavaScript,只需要纯CSS.我找到了一些解决方案,但所有这些解决方案都缺少Internet Explorer 6支持.

<body>
    <div>Div to be aligned vertically</div>
</body>
Run Code Online (Sandbox Code Playgroud)

如何div在所有主流浏览器(包括Internet Explorer 6)中垂直居中?

css cross-browser alignment vertical-alignment centering

1310
推荐指数
23
解决办法
141万
查看次数

Twitter Bootstrap - 如何水平或垂直居中元素

有没有办法在主要父母的内部垂直或水平居中html元素?

css twitter-bootstrap

282
推荐指数
9
解决办法
54万
查看次数

垂直居中的Bootstrap模态窗口

我想将我的模态放在视口中间(中间)我试图添加一些css属性

 .modal { position: fixed; top:50%; left:50%; }   
Run Code Online (Sandbox Code Playgroud)

我正在使用这个例子http://jsfiddle.net/rniemeyer/Wjjnd/

我试过了

$("#MyModal").modal('show').css(
    {
        'margin-top': function () {
            return -($(this).height() / 2);
        },
        'margin-left': function () {
            return -($(this).width() / 2);
        }
    })
Run Code Online (Sandbox Code Playgroud)

javascript twitter-bootstrap bootstrap-modal

177
推荐指数
13
解决办法
23万
查看次数

Bootstrap 4中心垂直和水平对齐

我有一个只存在表单的页面,我希望将表单放在屏幕的中心.

<div class="container">
  <div class="row justify-content-center align-items-center">
    <form>
      <div class="form-group">
        <label for="formGroupExampleInput">Example label</label>
        <input type="text" class="form-control" id="formGroupExampleInput" placeholder="Example input">
      </div>
      <div class="form-group">
        <label for="formGroupExampleInput2">Another label</label>
        <input type="text" class="form-control" id="formGroupExampleInput2" placeholder="Another input">
      </div>
    </form>   
  </div>  
</div>
Run Code Online (Sandbox Code Playgroud)

justify-content-center对齐表格水平,但我无法弄清楚如何垂直对齐.我试过使用align-items-centeralign-self-center,但它不起作用.

我错过了什么?

DEMO

css centering twitter-bootstrap bootstrap-4

126
推荐指数
7
解决办法
30万
查看次数