Bootstrap 3 breakpoints and media queries

后端 未结 9 1382
伪装坚强ぢ
伪装坚强ぢ 2020-11-27 09:08

On the Bootstrap 3 media queries documentation it says:

We use the following media queries in our Less files to create the key breakpoints in our grid

9条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-11-27 09:43

    This issue has been discussed in https://github.com/twbs/bootstrap/issues/10203 By now, there is no plan to change Grid because compatibility reasons.

    You can get Bootstrap from this fork, branch hs: https://github.com/antespi/bootstrap/tree/hs

    This branch give you an extra breakpoint at 480px, so yo have to:

    1. Design for mobile first (XS, less than 480px)
    2. Add HS (Horizontal Small Devices) classes in your HTML: col-hs-*, visible-hs, ... and design for horizontal mobile devices (HS, less than 768px)
    3. Design for tablet devices (SM, less than 992px)
    4. Design for desktop devices (MD, less than 1200px)
    5. Design for large devices (LG, more than 1200px)

    Design mobile first is the key to understand Bootstrap 3. This is the major change from BootStrap 2.x. As a rule template you can follow this (in LESS):

    .template {
        /* rules for mobile vertical (< 480) */
    
        @media (min-width: @screen-hs-min) {
           /* rules for mobile horizontal (480 > 768)  */
        }
        @media (min-width: @screen-sm-min) {
           /* rules for tablet (768 > 992) */
        }
        @media (min-width: @screen-md-min) {
           /* rules for desktop (992 > 1200) */
        }
        @media (min-width: @screen-lg-min) {
           /* rules for large (> 1200) */
        }
    }
    

提交回复
热议问题