CSS:修改可变高度元素内的节的高度 [英] CSS: fix the height of a section within a variable height element

查看:166
本文介绍了CSS:修改可变高度元素内的节的高度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

相关于这个问题

这里是一个小提琴: http://jsfiddle.net/DRbRS /

请注意,红色轮廓列表div不会在绿色容器div的底部对齐。

Notice how the red-outlined list div does not align at the bottom of the green container div.

问题是,没有办法提前知道列表的结果高度应该是什么,即使头的高度是已知的。

The problem is that there is no way of knowing ahead of time what the resulting height of the list ought to be, even if the height of the header is known.

有没有办法处理这个问题,而不使用javascript?

Is there any way to deal with this without resorting to javascript?

我们需要的是一种类似 height:fill;

What we need is a style like height: fill;

推荐答案

使用 position:absolute 并设置顶部,左侧,右侧和底部:http://jsfiddle.net/QARC9/

Using position: absolute and setting top, left, right, and bottom: http://jsfiddle.net/QARC9/

本文介绍了它的工作原理。

This article describes why it works.

http://www.alistapart.com/articles/conflictingabsolutepositions/

这篇关于CSS:修改可变高度元素内的节的高度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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