我有三个blurb,每个都包含图像,标题,段落和按钮(从上到下)。我的问题是,当屏幕大小展开时,段落开始重叠按钮。按钮位置需要在每个街区保持一致。它目前定位为绝对值,具有40像素的底部属性。我打算修正只有HTML/CSS或Jquery。任何帮助深表感谢。谢谢。如何在屏幕宽度发生变化时阻止两个内部div的重叠
.history_link {
position: relative;
width: 33.33%;
height: 599px;
}
.history_link h3 {
text-align: center;
}
.learn_btn {
margin-top: 20px;
width: 150px;
padding: 10px;
position: absolute;
bottom: 40px;
margin-left: auto;
margin-right: auto;
left: 0;
right: 0;
}
.rs_caption p {
width: 80%;
margin-left: 10%;
margin-right: 10%;
padding-top: 30px;
text-align: center;
}
.history_link img {
width: 60%;
margin-left: 20%;
margin-left: 20%;
padding: 35px 0px 0px 0px;
}
<div class="history_link col span_4">
<div class="why_rs_link">
<img src="<?php bloginfo('template_directory'); ?>/img/history_icon.png" />
<h3>Our History</h3>
<div class="rs_caption">
<p>Founded by teacher and mentor Patricia DeOrio, herself dyslexic, we’ve always understood what it takes to unlock the potential of children with learning differences.</p>
<a href="http://riversideschool.rpmdevserver.com/our-history/">
<h2 class="learn_btn">LEARN MORE</h2>
</a>
</div>
</div>
</div>
button with absolute positioning displaying correctly
button with absolute positioning with overlap when screen size expands
是否确定了你的情况来指定'为div的最小height'? –
绝对定位将元素从当前文档流中取出,并且相对于最接近的定位父项进行定位。如果没有定位祖先元素,那么这将相对于视口(浏览器窗口)。在你的屏幕截图中没有理由使用绝对定位。您的设计是一个容器中的三个垂直堆叠元素。另外,当您提供HTML示例时,请提供生成的标记(即不包含PHP)。 – hungerstar