您可以将具有位置:相对的图像与具有位置:绝对的图像对齐吗?
我在一页上有两个图像。第一个图像的位置:相对,第二个图像位于第一个图像的正下方,位置:绝对。是否可以将第二张图像与另一张图像对齐,以便在放大或缩小时它们的相对位置保持不变?
I have two images on a page. The first image has position:relative and the second image is right under the first image with position:absolute. Is it possible to align the second image with the other one so that their relative positions remain the same as you zoom in or out?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您使用浏览器进行缩放,则元素位置崩溃是很常见的情况。所以我不建议你太关注它。但无论如何,您的图像必须具有相同的父级,即具有“位置:相对”。
HTML
CSS
左:0;顶部:0; - 插入您自己的价值观。
If you zoom with your browser, crashing elements position is an ordinary situation. So I'd not advise you to pay so much attention to it. But in any case your images must have the same parent, that has "position: relative".
HTML
CSS
left: 0; top: 0; - insert your own values.
类似这样的?
Something like this?