溢出隐藏不工作,父亲亲属的位置 [英] overflow hidden not working, position of parent relative
本文介绍了溢出隐藏不工作,父亲亲属的位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想裁剪太高的图像。但是overflow:hidden没有做任何事情。
这是我的HTML:
< body id =index_body>
< div id =panel>
< div class =user_container>
< img class =photo_thumbnailsrc =https://encrypted-tbn1.gstatic.com/images?q=tbn:ANd9GcRRK4PrgJXJ05LYI33B5rqX4xh18UIUQ_kqplT_rXheF5bqPHrE/>
< / div>
。 。 。
< / div>
< / body>
这是我的CSS:
#index_body {
margin:0;
padding:0;
宽度:100%;
text-align:center;
}
#panel {
display:inline-block;
宽度:90%;
margin:auto;
text-align:left;
}
.user_container {
margin:15px;
border-radius:5px;
职位:亲属;
width:170px;
height:170px;
z-index:1;
display:inline-block;
border:2px蓝色;
}
.photo_thumbnail {
margin:0;
z-index:1;
位置:绝对;
border-radius:5px;
border:2px灰色立体;
width:170px;
overflow:hidden;
$ / code>
请参阅此处的操作: http://jsfiddle.net/9oLzynbx/1/ 。 其他人已经报道当它被归因于img时,隐藏溢出的问题不在位置为relative的父div中。请参阅:溢出:隐藏不工作。但那不是我的问题。
感谢您的帮助! :
overflow:hidden;
放在容器上:.user_container
I want to crop images that are too tall. But "overflow: hidden" is not doing anything.
Here is my HTML:
<body id="index_body">
<div id="panel">
<div class="user_container">
<img class="photo_thumbnail" src="https://encrypted-tbn1.gstatic.com/images?q=tbn:ANd9GcRRK4PrgJXJ05LYI33B5rqX4xh18UIUQ_kqplT_rXheF5bqPHrE"/>
</div>
. . .
</div>
</body>
Here is my CSS:
#index_body {
margin: 0;
padding: 0;
width: 100%;
text-align: center;
}
#panel {
display: inline-block;
width: 90%;
margin: auto;
text-align: left;
}
.user_container {
margin: 15px;
border-radius: 5px;
position: relative;
width: 170px;
height: 170px;
z-index: 1;
display: inline-block;
border: 2px dashed blue;
}
.photo_thumbnail {
margin: 0;
z-index: 1;
position: absolute;
border-radius: 5px;
border: 2px gray solid;
width: 170px;
overflow: hidden;
}
See it in action here: http://jsfiddle.net/9oLzynbx/1/.
Others have reported an issue with overflow hidden when the img it's attributed to is not in a parent div with position: relative. See: overflow: hidden not working. But that's not my issue.
Thanks for any help!
解决方案
You need to put the:
overflow: hidden;
on the container: .user_container
这篇关于溢出隐藏不工作,父亲亲属的位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文