简体   繁体   English

如何在css中制作相对于屏幕尺寸的图像?

[英]How do I make an image relative to the screen size in css?

I have an image background in css and 2 images overlaying that.我有一个 css 图像背景和 2 个覆盖它的图像。 On my device I can line them up perfectly the way I want, but when I go to view them on another device or change my screen size, the 2 overlaying images change size and position while the background doesn't.在我的设备上,我可以按照我想要的方式将它们完美地排列起来,但是当我在另一台设备上查看它们或更改我的屏幕尺寸时,2 个重叠的图像会更改大小和位置,而背景则不会。 I know there's a line of css that I'm missing or doing wrong, so if anyone could help it would be much appreciated.我知道有一行 css 我遗漏或做错了,所以如果有人能提供帮助,我们将不胜感激。 Thanks, and here's my code:谢谢,这是我的代码:

在此处输入图片说明

实际上没关系,我刚刚发现通过使用百分比而不是像素来自动调整位置和宽度。

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

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