- 主题:请教:css垂直高度自适应
100%
body设置padding往里撑了
body的内容的高度正好扣掉了上下高度
【 在 shaolin (叶孤城|漫漫当爹路) 的大作中提到: 】
: 高怎么设?
: lz意图显然是浏览器大小不固定,上下划分各50px,中间充满。
: 不通过js,你怎么得到高的值?
: ...................
--
FROM 210.192.100.*
按照你的说法,
如果网页中可见区域的高是200px,
body设置height是100%,上下padding是50,
不管网页中有没有内容,整个页面被分割成3部分:
上下各50,中间100 ?
【 在 Goofect (1 Win TO GO!) 的大作中提到: 】
: 100%
: body设置padding往里撑了
: body的内容的高度正好扣掉了上下高度
: ...................
--
FROM 114.243.222.*
对.可能是我描述的不是很清晰.
我原来的想法就是要上靠顶,下靠底,
浏览器窗口大小可变,中间部分高度自适应窗口大小,填满整个高度,
如果中间部分内容高度超高,就在中间部分出滚动条.
他给的这个方法确实可以做到
不过我提这个问题其实想要知道的是
如何在content-height为h的elements里搞一个content-height为h-100的elements
他这个方法,实际是将body的content-height抠掉了100.是h-100 ---> h-100.
如果是div,设置padding只会撑高div,而不会改变content-height的.
【 在 shaolin (叶孤城|漫漫当爹路) 的大作中提到: 】
: 按照你的说法,
: 如果网页中可见区域的高是200px,
: body设置height是100%,上下padding是50,
: 不管网页中有没有内容,整个页面被分割成3部分:
: 上下各50,中间100 ?
--
FROM 210.192.100.*
如果没任何内容,你body怎么设置高 ?
【 在 Goofect (1 Win TO GO!) 的大作中提到: 】
: 对.可能是我描述的不是很清晰.
: 我原来的想法就是要上靠顶,下靠底,
: 浏览器窗口大小可变,中间部分高度自适应窗口大小,填满整个高度,
: ...................
--
FROM 114.243.222.*
??????????????????????????
body的高度不是窗口大小决定的么
他给的那个方法,100%是div的height
【 在 shaolin (叶孤城|漫漫当爹路) 的大作中提到: 】
: 如果没任何内容,你body怎么设置高 ?
--
FROM 210.192.100.*
你好好研究研究吧。
【 在 Goofect (1 Win TO GO!) 的大作中提到: 】
: ??????????????????????????
: body的高度不是窗口大小决定的么
: 他给的那个方法,100%是div的height
: ...................
--
FROM 114.243.222.*
没明白你指的是什么
那个例子确实解决了我提的那个问题.
IE7/Firefox/Chrome下都行.
【 在 shaolin (叶孤城|漫漫当爹路) 的大作中提到: 】
: 你好好研究研究吧。
--
FROM 210.192.100.*
附件(714B) test.html1、页面无doctype声明,运行在Quirks mode下,这个模式下的东西最好放弃研究跟
使用。
2、关于百分比高度,请参考:
http://www.w3.org/TR/CSS21/visudet.html#the-height-property
<percentage>
Specifies a percentage height. The percentage is calculated with
respect to the height of the generated box's containing block. If the
height of the containing block is not specified explicitly (i.e., it
depends on content height), and this element is not absolutely
positioned, the value computes to 'auto'. A percentage height on the
root element is relative to the initial containing block. Note: For
absolutely positioned elements whose containing block is based on a
block-level element, the percentage is calculated with respect to the
height of the padding box of that element. This is a change from CSS1,
where the percentage was always calculated with respect to the content
box of the parent element.
【 在 Goofect (1 Win TO GO!) 的大作中提到: 】
: 没明白你指的是什么
: 那个例子确实解决了我提的那个问题.
: IE7/Firefox/Chrome下都行.
: ...................
--
FROM 114.243.222.*
恩.quirks mode确实没考虑,我都是手写html,都没dtd申明.....
2也知道,只是好像对initial containing block的行为并没有明确的规定.所以才说body很特殊.
【 在 shaolin (叶孤城|漫漫当爹路) 的大作中提到: 】
: 1、页面无doctype声明,运行在Quirks mode下,这个模式下的东西最好放弃研究跟
: 使用。
: 2、关于百分比高度,请参考:
: ...................
--
FROM 210.192.100.*