css - float Div 导致裁剪子 div/图像溢出

标签 css image html overflow crop

我有一系列 float 的 div,每个 div 中都有绝对定位的图像。

如果此图片大于 div 宽度,则它会被裁剪掉。

虽然我已经设置了 overflow:visible 到 floats 和它们的父 div 它们仍然裁剪图像。

这是一个显示示例的 jsfiddle:http://jsfiddle.net/RkpAe/1/

CSS:

#main, #memorycontainer { height: 100%; width: 100%; overflow: visible; }

.memory { width: 250px; position: absolute; z-index: 98; width: 100px; height: 100px; overflow: visible; background: red;}

.memory { -webkit-border-radius: 50%; -moz-border-radius: 50%; -ms-border-radius: 50%; -o-border-radius: 50%; border-radius: 50%; z-index: 100; -webkit-border-radius: 50%; cursor: pointer; }

.memorytile { position: relative; z-index: 97; background: yellow; height: 300px; width: 200px; overflow: visible; float: left; margin: 0; padding: 0; -webkit-user-select: none; -khtml-user-select: none; -moz-user-select: none; -o-user-select: none; user-select: none; }

HTML:

<div id="main">
<div id="tile1" class="memorytile">
    <div class="memory" style="top: 50px; left: 150px;">
            Icon</div>
    Background Image
    </div>
<div id="tile2" class="memorytile"></div>

最佳答案

删除

position:relative; 

来自

.memorytile{}

这应该可以解决问题。

关于css - float Div 导致裁剪子 div/图像溢出,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21875434/

相关文章:

html - 如何在悬停多个缩略图图像时设置黑色透明度,每个图像都有不同的位置?

html - 外部图像链接

html - 调整浏览器大小时,导航栏未调整大小

java - 拉取表单名称作为参数

html - 如何将 bootstrap 3 表单控制输入与 hidden true 结合起来

javascript - jquery 删除基于之前的内容

html - 当我不知道它有多高时,如何从固定图像为 div 编写带纹理的、不重复的背景?

html - 在div中居中图像

javascript - 从 JavaScript 数组中取出 3 张随机图像和 1 个链接到其中一张图像的单词,并以单独的 div 显示在屏幕上

python - 如何使用python从图像中提取文本或数字