css媒体查询设置高度,css-媒体查询中使用的宽度

css-媒体查询中使用的宽度

所有设备(例如台式机,平板电脑,笔记本电脑/ Ipad,Iphone和智能手机)最重要的媒体查询宽度是多少?这些设备有标准宽度吗?

5个解决方案

75 votes

我到处都在寻找最佳答案。 在这里,我发现了。

@media (min-width:320px) { /* smartphones, iPhone, portrait 480x320 phones */ }

@media (min-width:481px) { /* portrait e-readers (Nook/Kindle), smaller tablets @ 600 or @ 640 wide. */ }

@media (min-width:641px) { /* portrait tablets, portrait iPad, landscape e-readers, landscape 800x480 or 854x480 phones */ }

@media (min-width:961px) { /* tablet, landscape iPad, lo-res laptops ands desktops */ }

@media (min-width:1025px) { /* big landscape tablets, laptops, and desktops */ }

@media (min-width:1281px) { /* hi-res laptops and desktops */ }

我认为使用移动优先方法更好。 从移动样式表开始,然后应用与其他设备相关的媒体查询。 感谢@ryanve。 链接在这里。

Nishantha answered 2020-06-25T04:09:31Z

17 votes

我发现这些是起点很好的断点,但是请随时进行测试和调整。 我还建议您使用ems而不是px来获得各种设备尺寸和分辨率的尺寸(此处描述的原因([http://blog.cloudfour.com/the-ems-have-it-proportional-media-queries-ftw/ ))]

所以上面的查询看起来像这样:

@media (min-width:20em) { /* smartphones, iPhone, portrait 480x320 phones */ }

@media (min-width:30.063em) { /* portrait e-readers (Nook/Kindle), smaller tablets @ 600 or @ 640 wide. */ }

@media (min-width:40.063em) { /* portrait tablets, portrait iPad, landscape e-readers, landscape 800x480 or 854x480 phones */ }

@media (min-width:60.063em) { /* tablet, landscape iPad, lo-res laptops ands desktops */ }

@media (min-width:64.063em) { /* big landscape tablets, laptops, and desktops */ }

@media (min-width:80.063em) { /* hi-res laptops and desktops */ }

在这里([http://pxtoem.com/)]上还有一个漂亮的像素可用于em计算器对于那些不那么熟悉的人,包括我自己。

Terri Swiatek answered 2020-06-25T04:10:00Z

4 votes

试试这个,包括视网膜

/* Smartphones (portrait and landscape) ----------- */

@media only screen

and (min-device-width : 320px)

and (max-device-width : 480px) {

/* Styles */

}

/* Smartphones (landscape) ----------- */

@media only screen

and (min-width : 321px) {

/* Styles */

}

/* Smartphones (portrait) ----------- */

@media only screen

and (max-width : 320px) {

/* Styles */

}

/* iPads (portrait and landscape) ----------- */

@media only screen

and (min-device-width : 768px)

and (max-device-width : 1024px) {

/* Styles */

}

/* iPads (landscape) ----------- */

@media only screen

and (min-device-width : 768px)

and (max-device-width : 1024px)

and (orientation : landscape) {

/* Styles */

}

/* iPads (portrait) ----------- */

@media only screen

and (min-device-width : 768px)

and (max-device-width : 1024px)

and (orientation : portrait) {

/* Styles */

}

/* Desktops and laptops ----------- */

@media only screen

and (min-width : 1224px) {

/* Styles */

}

/* Large screens ----------- */

@media only screen

and (min-width : 1824px) {

/* Styles */

}

/* iPhone 4 ----------- */

@media

only screen and (-webkit-min-device-pixel-ratio : 1.5),

only screen and (min-device-pixel-ratio : 1.5) {

/* Styles */

}

Mo. answered 2020-06-25T04:10:20Z

1 votes

试试这个媒体查询,它将对您有帮助

@media only screen and (min-width:1280px) {}

@media (min-width:1024px) and (max-width:1279px) {}

@media (min-width:768px) and (max-width:1023px) {}

@media (min-width:480px) and (max-width:767px) {}

@media screen and (max-width:479px) {}

@media only screen and (max-width:320px) {}

@media only screen and (max-width:767px) {}

Amaresh Tiwari answered 2020-06-25T04:10:40Z

0 votes

完美的媒体查询

@media (max-width:400px) {}

@media (min-width:401px) and (max-width:599px) {}

@media (min-width:600px) and (max-width:767px) {}

@media (min-width:768px) and (max-width:950px) {}

@media (min-width:951px) and (max-width:1050px) {}

@media (min-width:1051px) {}

shammidevd answered 2020-06-25T04:11:00Z

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值