【发布时间】:2021-03-02 15:19:32
【问题描述】:
我在制作响应式轮毂盖配置器时遇到问题。我不知道如何处理它。我试图用 CSS 网格来制作它,但每次我改变网站的大小时,我的轮胎都不能完美地适应它们的位置。我在想这样的事情:
但不幸的是它不起作用。
现在我正在尝试使用相对位置和绝对位置,但它仍然不起作用。
HTML:
<main class="content">
<div class="content__car">
<img src="assets/kolpaki_bez_opon/4racing/le_mans_pro_pink_black.png" alt="" class="content__rig-left">
<img src="assets/kolpaki_bez_opon/4racing/le_mans_pro_pink_black.png" alt="" class="content__rig-right">
</div>
</main>
文字:
.content {
background: url('../assets/tlo_3.png');
background-position: center;
background-size: center;
background-repeat: no-repeat;
height: 70vh;
position: relative;
&__car {
background: url('../assets/auto/bmw/black.png');
background-position: center;
background-size: cover;
background-repeat: no-repeat;
position: absolute;
margin-left: auto;
margin-right: auto;
left: 0;
right: 0;
bottom: 5%;
text-align: center;
height: 70%;
width: 70%;
}
&__rig-left {
position: absolute;
left: 12.7%;
bottom: 0;
width: 15%;
}
&__rig-right {
position: absolute;
right: 16.5%;
bottom: 0;
width: 15%;
}
}
它看起来像这样,但它没有响应:
如果您能以某种方式帮助我,我将不胜感激,顺便说一句,这是我的第一篇文章 :)
【问题讨论】:
-
你能把你的代码放到一个工作的sn-p中吗 - 包括图像。问题是您根据用户所在设备的纵横比放置轮胎,但无论设备的纵横比如何,您都需要根据汽车图像放置轮胎。
标签: html css sass grid responsive