仅在iPad纵向方向上居中引导导航栏项目?

时间:2014-11-06 10:02:39

标签: ios css twitter-bootstrap ipad

有可能吗?

我一直试图使用以下媒体查询来居中导航栏项目:

@media only screen 
and (min-device-width : 768px) 
and (max-device-width : 1024px) 
and (orientation : portrait) {
  .navbar .navbar-nav .navbar-right>li {
      display: inline-block;
      float: none;
      vertical-align: top;
}

   .navbar .navbar-collapse {
       text-align: center;
  }
}

我也试过

margin: 0 auto;

1 个答案:

答案 0 :(得分:0)

您在http://jsfiddle.net/sLhxq16p/3/

@media handheld, only screen and (min-width: 768px), only screen and (min-device-width: 768px), only screen and (max-width: 1024px), only screen and (max-device-width: 1024px) and (orientation: portrait) {
    .nav li {
        text-align: center;
    }
}

仅限iPad肖像(iPad 3和4)

@media only screen and (min-device-width : 768px) and (max-device-width : 1024px) and (orientation : portrait) and (-webkit-min-device-pixel-ratio: 2) {
   .nav li {
        text-align: center;
    }
}

仅限iPad肖像(iPad 1和2)

@media only screen and (min-device-width : 768px) and (max-device-width : 1024px) and (orientation : portrait) and (-webkit-min-device-pixel-ratio: 1) {
    .nav li {
        text-align: center;
    }
}