Bootstrap Responsive layout hide nav on iPad

陌路散爱 提交于 2019-12-11 13:50:09

问题


Bootstrap has an amazing responsive layout system, however, sometimes its sizing with retina screens isn't quite 'right'.

For example, my retina iPad has a huge screen size but the actual display isn't the same. On the iPad I'd like to hide the left navigation component and use the expand button in the header control to show/hide, however, my iPad retina hits the large screen size and therefore is not hidden.

I've got my left nav using the bootstrap 3 classes: nav-left nav-collapse and I realize I can adjust the min/mid/max sizes but i dont think thats the right approach. What am I missing?


回答1:


Style your page using @media queries.

Just like this:

@media for retina

@media only screen 
  and (min-device-width: 1536px)
  and (max-device-width: 2048px)
  and (orientation: landscape)
  and (-webkit-min-device-pixel-ratio: 2) {
  .nav-left {
    /* STYLE HERE YOUR MIN/MAX SIZE */
  }

  .nav-collapse {
    /* STYLE HERE YOUR MIN/MAX SIZE */
  }
}

@media for iPad Landscape and Portrait

@media only screen 
  and (min-device-width: 768px) 
  and (max-device-width: 1024px) {
  /* STYLES GO HERE */
}

Source of @media for iPad/iPhone @media queries



来源:https://stackoverflow.com/questions/20221111/bootstrap-responsive-layout-hide-nav-on-ipad

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!