【发布时间】:2021-07-29 20:24:15
【问题描述】:
Bootstrap 已经使相对图像具有响应性,但绝对图像没有,当您切换到移动设备时,a 会减小浏览器上的屏幕尺寸,其他图像会错位。
.title-img {
position: relative;
width: 100%;
height: 100%;
}
.skill-back {
position: absolute;
bottom: 25%;
top: 10%;
right: 6%;
width: 50%;
height: 100%;
opacity: 0.5;
z-index: -1;
}
.html {
position: absolute;
z-index: 4;
width: 15%;
height: auto;
top: 450px;
left: 75%;
}
.css {
position: absolute;
width: 10%;
top: 70%;
left: 52%;
z-index: 3;
height: auto;
}
.js {
position: absolute;
width: 8%;
left: 79%;
top: 38%;
z-index: 1;
height: auto;
}
<div class="profile col-lg-6">
<img class="skill-back" src="images/skill-back.svg" alt="black-circle">
<img class="html" src="images/html-skill.svg" alt="html-skill">
<img class="js"src="images/js-skill.svg" alt="">
<img class="css"src="images/css-skill.svg" alt="">
<img class="title-img" src="images/developerboy.svg" alt="developerboy">
</div>
【问题讨论】:
-
为什么你对图片使用绝对位置?
-
因为我希望它们位于主图像顶部的特定位置,就像运球上的这个 UI:dribbble.com/shots/11276631-DS-Personal-Developer-Portfolio/…
标签: html css responsive-design bootstrap-5 responsive-images