Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/40.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html 移动设备上引导模式的垂直对齐_Html_Css_Twitter Bootstrap - Fatal编程技术网

Html 移动设备上引导模式的垂直对齐

Html 移动设备上引导模式的垂直对齐,html,css,twitter-bootstrap,Html,Css,Twitter Bootstrap,这个问题似乎在github上被问了很多次,但我没有找到任何解决方案: 如何在小屏幕上正确地垂直对齐模式?编辑:从Bootstrap 2.0.2开始,这不再是一个问题。基本上,bootstrap现在实现了下面提出的解决方案,我将在这里留作参考。 通常,在小屏幕上,模态会占据大部分窗口,因此相对于触发模态的按钮的定位没有太大意义。我通常只是覆盖手机的模态位置: @media (max-width: 767px) { .modal { top: 20px; // nega

这个问题似乎在github上被问了很多次,但我没有找到任何解决方案:


如何在小屏幕上正确地垂直对齐模式?

编辑:从Bootstrap 2.0.2开始,这不再是一个问题。基本上,bootstrap现在实现了下面提出的解决方案,我将在这里留作参考。

通常,在小屏幕上,模态会占据大部分窗口,因此相对于触发模态的按钮的定位没有太大意义。我通常只是覆盖手机的模态位置:

@media (max-width: 767px) {
  .modal {
      top: 20px;
      // negative left margin to position horizontally.
      margin: 0 0 0 -280px; 
      // already in modals.less, just copied for clarification:
      left: 50%;  
      position: fixed;
   }
}

(这在较少的纯CSS解决方案中看起来很相似)。

是否有一种通用的官方方法可以做到这一点?回到bootstrap 1.x,不幸的是,这是唯一的方法。在较新的版本中,这是通过引导解决的。