我不明白为什么在iphone上我没有看到完整的背景,但它看起来像是剪掉了!
照片的紫色部分是画布,而粉红色部分是背景,我想在iphone上旋转屏幕并改变背景,但是当我做背景时,背景没有全部显示,而那个小白片仍然存在!在anrdoid设备上,它可以工作..。
IPHONE屏幕:

三星屏幕:

这是我在css上使用的代码:
@media screen and (min-width: 320px) and (max-width: 667px) and (orientation: portrait) {
html {
transform: rotate(-90deg);
transform-origin: left top;
width: 100vh;
height: 100vw;
background: rgb(248, 184, 158);
background: radial-gradient(
circle,
rgba(248, 184, 158, 1) 27%,
rgba(210, 64, 49, 1) 70%
);
overflow-x: auto;
position: absolute;
top: 100%;
left: 0;
}
}发布于 2022-09-19 08:36:09
正如注释中提到的,您必须使用vw表示宽度,使用vh表示高度。还可以查看自动修复程序,它重新生成您的css代码,以便每个设备上的每个浏览器都能理解它。
下面是到在线生成器的链接:https://autoprefixer.github.io/
另外,一定要清除测试设备上的浏览器缓存,这可能会导致旧代码的加载。
发布于 2022-09-19 08:58:09
为什么要设置top: 100%;而不是top: 0;?top: 100%;按下背景。
此外,我认为您需要一个div容器来执行旋转,而不是html文档。
https://stackoverflow.com/questions/73770297
复制相似问题