简体   繁体   English

CSS 媒体查询断点

[英]CSS Media Query breakpoints

just a quick question.只是一个快速的问题。 What is the best set for css breakpoints? css 断点的最佳设置是什么?

Right now I'm using this one:现在我正在使用这个:

min 1200px
max 1200px
max 900px
max 600px
max 480px
max 320px

Anyway there is a problem with the min 1200px because the differents between a 1200px and a 1800px screen are huge.无论如何,最小 1200px 存在问题,因为 1200px 和 1800px 屏幕之间的差异很大。

You can visit this site Overview您可以访问本网站概览

// Small devices (landscape phones, 576px and up)
@media (min-width: 576px) { ... }

// Medium devices (tablets, 768px and up)
@media (min-width: 768px) { ... }

// Large devices (desktops, 992px and up)
@media (min-width: 992px) { ... }

// Extra large devices (large desktops, 1200px and up)
@media (min-width: 1200px) { ... }

From W3Schools来自W3Schools

There are tons of screens and devices with different heights and widths, so it is hard to create an exact breakpoint for each device.有大量不同高度和宽度的屏幕和设备,因此很难为每个设备创建一个准确的断点。 To keep things simple you could target five common groups:为简单起见,您可以针对五个常见群体:

/* Extra small devices (phones, 600px and down) */
@media only screen and (max-width: 600px) {...}

/* Small devices (portrait tablets and large phones, 600px and up) */
@media only screen and (min-width: 600px) {...}

/* Medium devices (landscape tablets, 768px and up) */
@media only screen and (min-width: 768px) {...}

/* Large devices (laptops/desktops, 992px and up) */
@media only screen and (min-width: 992px) {...}

/* Extra large devices (large laptops and desktops, 1200px and up) */
@media only screen and (min-width: 1200px) {...}

Bootstrap breakpoints are very standard. Bootstrap 断点是非常标准的。 You can use these breakpoints.您可以使用这些断点。

// X-Small devices (portrait phones, less than 576px)
// No media query for `xs` since this is the default in Bootstrap

// Small devices (landscape phones, 576px and up)
@media (min-width: 576px) { ... }

// Medium devices (tablets, 768px and up)
@media (min-width: 768px) { ... }

// Large devices (desktops, 992px and up)
@media (min-width: 992px) { ... }

// X-Large devices (large desktops, 1200px and up)
@media (min-width: 1200px) { ... }

// XX-Large devices (larger desktops, 1400px and up)
@media (min-width: 1400px) { ... }

Read more about that阅读更多相关信息

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM