CSS - 绝对位置 &文件流程 [英] CSS - position absolute & document flow

查看:24
本文介绍了CSS - 绝对位置 &文件流程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是的,我知道绝对位置不起作用,但是有没有办法显示元素下方"(在代码之后)而不是在它们后面?

Yes, I know doesn't work with position absolute, but is there a way to display elements "below" (after in code) not behind them?

示例:

<img src="image.jpg" style="width: 500px; height: 400px; position: absolute; top: 0;" /> 
<h2 style="padding: 15px" >This text is behind not below the image</h2>

有没有办法在图像下面显示h2除了绝对定位它?

Is there a way of displaying the h2 below the image excepting positioning it absolutely too?

示例:

http://jsfiddle.net/fDGHU/1/

(是的,我必须在我的情况下使用绝对值,以及下面的动态边距内容,我迷失 :D)

(yes, I have to use absolute in my case, and dynamic margined content below, and I'm lost :D)

推荐答案

我能够按照您的要求执行的唯一方法是设置 h2top 属性,也就是在图像之后定位文本.小提琴.

The only way I was able to do what you are asking is setting the top property of h2, aka positioning the text after the image. Fiddle.

PS:position:block 不存在.只有absoluterelativestaticfixed.

PS: position:block doesn't exist. Only absolute, relative, static, and fixed.

这篇关于CSS - 绝对位置 &amp;文件流程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆