[英]CSS wrapping text with overflow hidden div not working?
In my css,i write a class style overflow : hidden
.My div contains a small image and some paragraph text. 在我的CSS中,我写了一个类样式
overflow : hidden
我的div包含一个小图像和一些段落文本。 if the overflow is hidden in the sense the word wrap doesn't work. 如果在某种意义上隐藏了溢出,则自动换行不起作用。 if i remove,it works.
如果我删除,它的工作原理。 but i need both overflow hidden and also word wrap.
但是我既需要隐藏溢出,也需要自动换行。
.img-block_100 {
height: 100px;
width: 100px;
float: left;
margin-right: 5px;
}
.img-block_100 img {
max-width: 100%;
}
.ee-content {
width: 100%;
height: 140px;
overflow: hidden;
width: 250px;
}
It's because overflow: hidden
was clearing the floated img
element. 这是因为
overflow: hidden
正在清除浮动的img
元素。
One solution would be to wrap both of the elements and then add overflow: hidden
to the wrapper. 一种解决方案是包装两个元素,然后添加
overflow: hidden
到包装器中。 In doing so, the floated img
isn't being cleared, and the text wraps around the img
as expected. 这样做不会清除浮动的
img
,并且文本会按预期环绕 img
。
.content-wrapper {
width: 250px;
height: 140px;
overflow: hidden;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.