改为应用clip-path
到跨度但请注意,clip-path
这不会删除不可见的部分。
span {
float: left;
background-color: lightblue;
clip-path: polygon(0 0, 100% 0, 100% 64%, 0 64%);
}
p {
clear:both;
}
<span>
<img src="//via.placeholder.com/350x150">
</span>
<p>some text here</p>
clip-path
您可以通过在跨度和设置上使用固定高度来避免overflow:hidden
这种情况,在这种情况下,您将删除不需要的部分:
span {
float: left;
background-color: lightblue;
height:100px;
overflow:hidden;
}
p {
clear:both;
}
<span>
<img src="//via.placeholder.com/350x150">
</span>
<p>some text here</p>
另一个想法是也使用图像作为背景:
span {
float: left;
background-color: lightblue;
height:100px;
width:350px;
}
p {
clear:both;
}
<span style="background-image:url(//via.placeholder.com/350x150)">
</span>
<p>some text here</p>