【发布时间】:2016-12-22 23:43:16
【问题描述】:
我正在尝试在 html/css 中创建一个框(其中的 div 彼此相对),其中读取更多超链接文本(相对定位),覆盖背景图像(绝对)。这样就可以在描述中添加更多的文字,框而不是重叠图像。
如您所见,描述忽略了图像位置和重叠。
有谁知道我将如何制作它,以便它推动阅读更多和下面的图像,而不是重叠?
html 代码:
<div class="box">
<div class="box-cont">
<span class="content-type"></span>
<h2 itemprop="name">Test limit thingTest limit thingTest limit thingTest limit thingTest..</h2>
<p class="meta">By random name, and random, on 7 Random 2018</p>
<p class="desc" itemprop="description">Look, just because I don't be givin' no man a foot massage don't make it right for Marsellus to throw Antwone into a glass ************' house, ******' up th
<span class="img"><img src="/assets/image.jpg" alt="Screen bw"></span>
<p class="cta"><span>+ read more</span></p>
</div>
</div>
</a>
css 代码:
box-wrap {
margin-bottom: 10px;
display: block;
text-decoration: none;
color: #1e5373;
}
.section-boxes .box {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
overflow: hidden;
}
box p, .box h2, .box .content-type {
position: relative;
z-index: 2;
}
.box .img img {
display: block;
width: 100%;
height: auto;
}
img {
max-width: 100%;
height: auto;
}
.section-boxes .box .cta {
position: absolute;
bottom: 30px;
}
这是我通过实际控制盒子中的一些/大部分定位而设法过滤的内容。描述的 z-index 较高,这就是它与阅读更多框重叠的原因。
【问题讨论】:
-
分享一些代码,以便有人可以帮助您。
-
分享你的代码
-
aavrug,我也很喜欢,代码严重分散在不同页面的负载中(我没有写),即使是一个模糊的答案也会为我指明正确的方向现在,说实话。
-
你好。您要做的是向我们提供与问题相关的 HTML 和 CSS。 (我们不想要也不需要全部)在不知道当前设置的情况下,几乎不可能为您提供任何帮助。