CSS窗口调整浏览器高度

时间:2013-07-24 08:56:53

标签: css position positioning css-position

我尝试创建一个具有固定宽度并居中的窗口。 也应具有可变高度,具体取决于browser-viewport-height,顶部偏移量为20px,底部偏移量为20 px;

我不想为此使用JQuery / JS,它应该是普通的CSS。

这里有一些代码剪切:

#viewport should be the the browsers height / width container
#window should be the resized window (centered in middle, filling up all height except of top 20px and bottom 20px

http://jsfiddle.net/ejRTU/87/

有人知道如何解决这个问题吗?

1 个答案:

答案 0 :(得分:0)

使用position:absolute并将top和bottom属性设置为10px;请看这个小提琴jsfiddle.net/ejRTU/88/