【发布时间】:2021-02-22 02:11:45
【问题描述】:
我正在尝试制作一张图像向左侧偏移 50% 的卡片。随着相对位置的图像被裁剪。我得到的结果如图所示。
我的 CSS 是
.card2 {
position: relative;
margin: 0;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.26);
border-radius: 6px;
padding: 1rem;
overflow: hidden;
background-color: rgb(255, 255,255,1);
margin:0px auto;
width: 80vw;
height: 60vh;
}
.dvInsideTL {
position: absolute;
left:-40px;
z-index: 100;
}
而html是
<div class="card2">
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the
industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and
</p>
<div class="dvInsideTL">
<img src="https://via.placeholder.com/250" alt="" />
</div>
</div>
【问题讨论】:
标签: html css placeholder