图像从容器中伸出
Image sticking out of it's container
如何让图像从他的容器中突出来并保持它的透明背景?我最近在许多类似初创公司的网站上看到了很多(如下所示)。能不能玩个overflow或者翻译一下属性?非常感谢。
编辑:这是图片来自的页面 startup template
试试这个:
.section-1 {
height: 300px;
background-color: #ddd;
}
.section-2 {
position: relative;
background-color: #eee;
}
.img-responsive {
display: block;
max-width: 100%;
height: auto;
}
.img-overlayed {
position: relative;
top: -155px;
margin: 0 auto -155px;
}
<section class="section-1">
</section>
<section class="section-2">
<img src="http://placehold.it/400x400" alt="" class="img-responsive img-overlayed">
</section>
只要图像具有透明度,部分的背景就会显示出来。
如何让图像从他的容器中突出来并保持它的透明背景?我最近在许多类似初创公司的网站上看到了很多(如下所示)。能不能玩个overflow或者翻译一下属性?非常感谢。
编辑:这是图片来自的页面 startup template
试试这个:
.section-1 {
height: 300px;
background-color: #ddd;
}
.section-2 {
position: relative;
background-color: #eee;
}
.img-responsive {
display: block;
max-width: 100%;
height: auto;
}
.img-overlayed {
position: relative;
top: -155px;
margin: 0 auto -155px;
}
<section class="section-1">
</section>
<section class="section-2">
<img src="http://placehold.it/400x400" alt="" class="img-responsive img-overlayed">
</section>
只要图像具有透明度,部分的背景就会显示出来。