我正在尝试创建一个带有一些基本文本元素的div。我的要求是div内的元素应该根据div对齐,因此我将绝对定位与我的主div定位为相对值,并将百分比值赋予它,以便它们可以在响应式屏幕中工作。我甚至在媒体屏幕中改变了一些最低的百分比。但是,在某些情况下,当屏幕大小发生变化时,一个文本或div区块会相互重叠。有没有办法在响应式屏幕中避免这种重叠?预先感谢您:)避免与响应中的绝对位置重叠
.Heading{
position:relative;
}
.Heading h3{
top:1%;
position:absolute;
left:0;
right:0;
}
.Text{
Position: absolute;
top: 10%;
}
.bottom-part{
position:absolute;
top:60%;
}
<div class="main">
<div class="Heading">
<h3>Heading part</h3>
</div>
<div class="Text">
<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 scrambled it to make a type specimen book. It
has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop
publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p>
</div>
<div class="bottom-part">
<h4>Here's the ending part</h4>
</div>
</div>
为什么你'绝对'这个div,你可以简单地做这个'float:left'属性 –