简体   繁体   English

常见平板电脑尺寸的CSS媒体查询

[英]CSS Media Queries for Common Tablet Sizes

I was hoping someone either with a few different tablets to test on, or with vast theoretical understanding could tell me if my query to target common tablet sizes ( taken from: http://nmsdvid.com/snippets/ ) would work. 我希望有人可以使用几种不同的平板电脑进行测试,或者通过广泛的理论理解可以告诉我,我的常见平板电脑尺寸(取自: http//nmsdvid.com/snippets/ )的查询是否有效。

My main point of question is if the operators (specifically for the targeting one of 4 different devices) are correct; 我的主要观点是运营商(特别是针对4种不同设备中的一种)是否正确;

@media only screen and (
    ((min-device-width : 768px) and (max-device-width : 1024px)),
    ((min-device-width : 600px) and (max-device-width : 1024px)),
    ((min-device-width : 800px) and (max-device-width : 1080px)),
    ((min-device-width : 800px) and (max-device-width : 1280px))
) and (orientation : landscape) {

    body{ background-color: pink; }

}

Unfortunately, there is no answer to your question. 不幸的是,你的问题没有答案。 Just because there is no answer to the question "common tablet sizes". 仅仅因为对“普通平板电脑尺寸”这个问题没有答案。 You will find old laptops narrower than current tablets and tablets with wider resolution as netbooks. 你会发现旧的笔记本电脑比目前的平板电脑和平板电脑更窄,分辨率更高的上网本。

Look into my database of media features and try for the best. 查看我的媒体功能数据库,并尽力做到最好。

That said, Lokase answer is the best. 也就是说,Lokase的答案是最好的。 Do not try to target devices, try to make your website nice in all resolutions. 不要尝试定位设备,尝试使您的网站在所有分辨率中都很好。 It is not that complicated. 并不复杂。

The best approach I have found is to use a Device Agnostic Responsive Layout approach. 我发现的最佳方法是使用Device Agnostic Responsive Layout方法。

Set the media queries for a range (ie - dimensions that would cover all the tablets you are targeting) and then use a fluid approach to expand or contract the UI to the dimensions of the device. 设置范围的媒体查询(即 - 覆盖您所定位的所有平板电脑的尺寸),然后使用流畅的方法将UI扩展或收缩到设备的尺寸。

http://coding.smashingmagazine.com/2012/03/22/device-agnostic-approach-to-responsive-web-design/ http://coding.smashingmagazine.com/2012/03/22/device-agnostic-approach-to-responsive-web-design/

There are so many devices coming on the market everyday, its a losing battle to try and specifically target each and everyone. 每天都有很多设备上市,这是一场失败的战斗,试图专门针对每个人。

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

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