Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/39.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/88.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Css 当内容大于div1的大小时放置div2_Css_Html_Height_Overflow - Fatal编程技术网

Css 当内容大于div1的大小时放置div2

Css 当内容大于div1的大小时放置div2,css,html,height,overflow,Css,Html,Height,Overflow,我尝试在手机上使用响应css呈现页面。 我无法更改html,我只尝试用css解决我的问题 想象一下,我有一个这样的div: #example { width : 25px; height : 25px; } 在这个div中,我有一个1024*768的图像。 因此,内容比内容更大(我将显示所有内容) 我的问题是,以下内容将被放置在25像素的顶部,而不是下面的图像 编辑:一个新的JSFIDLE,更精确: 你知道吗? 非常感谢 CSS 谢谢您的解决方案在您的演示和JSFIDLE中完美地工

我尝试在手机上使用响应css呈现页面。 我无法更改html,我只尝试用css解决我的问题

想象一下,我有一个这样的div:

#example {
   width : 25px;
   height : 25px;
}
在这个div中,我有一个1024*768的图像。 因此,内容比内容更大(我将显示所有内容) 我的问题是,以下内容将被放置在25像素的顶部,而不是下面的图像

编辑:一个新的JSFIDLE,更精确:

你知道吗? 非常感谢

CSS


谢谢您的解决方案在您的演示和JSFIDLE中完美地工作。。。但不是在我的网站上:/我将继续我的调查:)我已经更精确地再现了在我的精确案例中不起作用的东西。内容有一个位置:相对,和一个与div大小相同的顶部。看演示:非常感谢@aldanux!但这并不完全正确。为了更好地理解,我将图像替换为文本。文本可以有不同的高度。如果文本长度超过250px,就可以了。但是当小于250px时,文本和行之间有一个边距。看看我更新的JSFIDLE:再次:谢谢,你真是太好了@托马斯:)好的。。。我想我现在肯定有了解决办法。。。我已经更新了我的答案。您可以更改文本(#pic),并且文本(#under)始终在下方留有边距(如果需要)。试试看,告诉我你的问题是否解决了。谢谢,谢谢,谢谢。谢谢你的耐心和帮助。你今天真的简化了某人的生活:)为什么当你的图像有更大的尺寸时,你的尺寸
#example
div设置为25x25?div永远不会改变尺寸。这里的图片是演示的,但在我的例子中是文本。查看一个新的JSFIDLE:关于
#在
标题/标签元素下,您希望它定位在哪里,在图像的下边缘,还是在
#示例
的下边缘,这样溢出的图像被绘制在文本上,这样标题/标签就不可见了?查看最新的JSFIDLE:。无论文本大小,Lorem Ipsum中的#under必须位于文本的正下方。谢谢你,马克!
#example {
   width : 250px;
   height : 250px;
   background-color : #123456;
}

#pic {
   margin-top: 250px;
   float: left;    
}


#under {
   margin-top: 10px; 
   float: left;
}