iPad 条件 CSS 不起作用

发布于 2025-01-03 20:51:45 字数 802 浏览 1 评论 0原文

我已经阅读了这里的几个问题以及 Google 寻找的东西,我发现了很多,但由于某种原因我无法让我的问题适用于 iPad。我能够让它在 iPhone 上运行,但 iPad 仍然显示我的 bg img。这些都是我尝试过但空手而归的所有查询。

    @media only screen and (min-device-width: 481px) and (max-device-width: 1024px) {

body.custom-background {

    background-color: #FFFFFF;
    background-image: none;

}
}

@media only screen and (min-width: 481px) and (max-width: 1024px) {

body.custom-background {

    background-color: #FFFFFF;
    background-image: none;

}
}

@media only screen and (min-device-width: 768px) and (max-device-width: 1024px) {

body.custom-background {

    background-color: #FFFFFF;
    background-image: none;

}
}

@media handheld and (max-device-width: 480px) {

body.custom-background {

    background-color: #FFFFFF;
    background-image: none;

}
}

I've read several of the questions on here as well as Google looking for stuff and I found a lot bu tfor some reason I can't get mine to work for iPads. I was able to get it working for iPhones but the iPad is still displaying my bg img. These are all the queries I've tried and came up empty handed.

    @media only screen and (min-device-width: 481px) and (max-device-width: 1024px) {

body.custom-background {

    background-color: #FFFFFF;
    background-image: none;

}
}

@media only screen and (min-width: 481px) and (max-width: 1024px) {

body.custom-background {

    background-color: #FFFFFF;
    background-image: none;

}
}

@media only screen and (min-device-width: 768px) and (max-device-width: 1024px) {

body.custom-background {

    background-color: #FFFFFF;
    background-image: none;

}
}

@media handheld and (max-device-width: 480px) {

body.custom-background {

    background-color: #FFFFFF;
    background-image: none;

}
}

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

甲如呢乙后呢 2025-01-10 20:51:45

愿你的 html 头部有 Meta 。像这样:

<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">

使用媒体查询

@media only screen and (min-device-width: 768px) and (max-device-width: 1024px) {

body.custom-background {

    background-color: #FFFFFF;
    background-image: none;

}
}

May you have Meta in you html head. like this:

<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">

with that media query

@media only screen and (min-device-width: 768px) and (max-device-width: 1024px) {

body.custom-background {

    background-color: #FFFFFF;
    background-image: none;

}
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文