div定位的问题
A 有类似的东西: 替代文本 http://img718.imageshack.us/img718/9625/88827634.png< /a>
没关系,但我想在内容顶部添加一些标题块。
所以它可以看起来像这样: 替代文本 http://img824.imageshack.us/img824/9541/31597153.png< /a>
我不知道标题高度是多少,因为会有一些动态内容。
如何解决这个问题呢?
A have something like that:
alt text http://img718.imageshack.us/img718/9625/88827634.png
It's OK but i want to add some Title block at the top of Content.
So it can be look like that:
alt text http://img824.imageshack.us/img824/9541/31597153.png
I don't know what Title height will be, because there will be some dynamic content.
How to solve this problem?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
为什么你把所有的div都放在绝对位置?
无论如何,您可以用 2 个 div 包裹标题和内容,外部 div 必须是绝对的,内部 div 是相对的,并且您可以在标题和内容
图中将绝对定位放在标题和内容的顶部和左侧,因为它不会超出你绘图的绿色和蓝色。
我将最外面的 div 绝对定位,因为你将所有 div 都绝对定位。我假设您已经有了所有尺寸,就像您的第一张图中一样。
why are you positioning all your divs in absolute?
anyways you can wrap Title and Content with 2 divs, the outer div must be in absolute and the inner div is a relative, and you can put an absolute positioning in your Title and Content
Figure out the Top and Left of Title and Content, since it will not go outside the green and blue colors of your drawing..
I position absolute the outermost div since you are positioning all your divs in absolute. I assume you already have the measurements for all just like in your first drawing.