gpt4 book ai didi

iPhone 网页版,推荐px 还是%?

转载 作者:技术小花猫 更新时间:2023-10-29 11:11:15 26 4
gpt4 key购买 nike

我还没有做过iphone版,所以有这个疑问,

为了能够正常浏览网站 - 即使用户将手机转动 90º:

enter image description here

我应该用 px 还是 % 设置 CSS?

最佳答案

如果您以编程方式针对 iOS 设备(例如 iPhone 和 iTouch),那么我会使用像素而不是百分比,但如果您不针对此类设备并且想要一个针对所有人(大多数智能手机)的一站式移动网站,那么我会考虑使用百分比。

您可以在媒体查询中指定 min-width max-width 和 min-device-width 和 max-device-width

这里是关于媒体查询和您可以执行的组合的更多信息;

/* Target iPhone Portrait */
@media screen and (max-width: 320px) and (orientation: portrait) { body{background:#F0F;} }

/* Target Android Portrait larger than 320px Width */
@media screen and (min-width: 321px) and (max-width: 480px) and (orientation: portrait) { body{background:#F00;} }

/* Target iPhone Landscape */
@media screen and (max-width: 480px) and (orientation: landscape) { body{background:#0F0;} }

/* Target Android Landscape */
@media screen and (min-width: 481px) and (max-width: 800px) and (orientation: landscape) { body{background:#FF0;} }

关于iPhone 网页版,推荐px 还是%?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7172745/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com