我试图在我的网站上制作这个组件。我想在右侧留下一些图片。它应该适应文字大小,并且必须始终处于最底层。我认为这是可能的位置:绝对和底部:0。但它不起作用。它一直在我的排上,我不知道为什么。为什么我的位置绝对不起作用?
.b-image {
position: absolute;
bottom: 0;
}
.over-image {
position: relative;
}
.content-width {
max-width: 1440px;
min-width: 300px;
margin: 0 auto;
padding: 0 24px;
position: relative;
}
section {
padding: 48px 0;
border-bottom: 1px solid #0000ff;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" />
<section>
<div class="row">
<div class="content-width">
<div class="content col-md-6">
<h1>
Headline
</h1>
<p>
foo foo foo foo foo foo foo foo foo foo foo foo foo foo
</p>
</div>
<div class="col-md-6 over-image">
<img class="b-image" src="http://placehold.it/100x100" alt="">
</div>
</div>
</div>
</section>
我没有看到你使用'位置:absolute' - 应该说是到位的'位置:汽车'''.b-image'? –
@RobinJames Ops,是的,你是对的。但仍然没有奏效。 – Paili
如果你有一个元素放置在绝对内部,元素放置在相对位置,那么绝对引用就是包含它的元素。 – Phylogenesis