在
http://getbootstrap.com/css/它说:
We use the following media queries to create the key breakpoints in
our grid system.Extra small devices (phones,up to 480px):
No media query since this is the default in BootstrapSmall devices (tablets,768px and up):
@media (min-width: @screen-sm) { … }Medium devices (desktops,992px and up):
@media (min-width: @screen-md) { … }Large devices (large desktops,1200px and up):
@media (min-width: @screen-lg) { … }
我们应该能够在我们的媒体查询中使用@ screen-sm,@ screen-md和@ screen-lg名称吗?因为它不适合我。我必须使用像素测量,如@media(min-width:768px){…},然后才能工作。我做错了什么?
此外,对于额外的小设备的打字错误的参考480px?不应该说高达767px?
解决方法
@nickforthought给出Bootstrap 3的最佳摘要,我们可以申请无Bootstrap我总是使用他的参考在我的工作中实现。
Bootstrap 3媒体查询
/*========== Mobile First Method ==========*/ /* Custom,iPhone Retina */ @media only screen and (min-width : 320px) { } /* Extra Small Devices,Phones */ @media only screen and (min-width : 480px) { } /* Small Devices,Tablets */ @media only screen and (min-width : 768px) { } /* Medium Devices,Desktops */ @media only screen and (min-width : 992px) { } /* Large Devices,Wide Screens */ @media only screen and (min-width : 1200px) { } /*========== Non-Mobile First Method ==========*/ /* Large Devices,Wide Screens */ @media only screen and (max-width : 1200px) { } /* Medium Devices,Desktops */ @media only screen and (max-width : 992px) { } /* Small Devices,Tablets */ @media only screen and (max-width : 768px) { } /* Extra Small Devices,Phones */ @media only screen and (max-width : 480px) { } /* Custom,iPhone Retina */ @media only screen and (max-width : 320px) { }
Bootstrap 2.3.2媒体查询
@media only screen and (max-width : 1200px) { } @media only screen and (max-width : 979px) { } @media only screen and (max-width : 767px) { } @media only screen and (max-width : 480px) { } @media only screen and (max-width : 320px) { }
资源来源:https://scotch.io/quick-tips/default-sizes-for-twitter-bootstraps-media-queries