2000字范文,分享全网优秀范文,学习好帮手!
2000字范文 > html固定页眉页脚 具有固定HTML页眉和页脚的页面布局 具有灵活的内容

html固定页眉页脚 具有固定HTML页眉和页脚的页面布局 具有灵活的内容

时间:2020-01-17 07:40:01

相关推荐

html固定页眉页脚 具有固定HTML页眉和页脚的页面布局 具有灵活的内容

我有一个网页(HTML + CSS),页眉和页脚已修复。

我希望页眉和页脚之间的Content-div是"灵活的"当浏览器窗口(文档)调整大小时。

如果Content-div太小而无法显示其内容,则Content-div必须显示水平和垂直滚动条 - 而不是浏览器窗口。

如果Content-div太大而无法显示其内容,Content-div不能显示水平和垂直滚动条 - 不是浏览器窗口。

简而言之,Content-div必须自动处理页眉和页脚之间浏览器的大小调整。

我的当前代码可能只是需要在CSS中进行一些调整才能做到这一点。

我目前硬编码Content-div的高度以强制滚动条(100px),但这应该会自动生效。

我是否应该考虑使用JavaScript来实现这一目标?

#header, #footer {

position:fixed;

left:0;

width:100%;

z-index:200;

height:100px;

background-color:brown;

border-style:solid;

border-width:1;

}

#header {

top:0;

}

#footer {

bottom:0;

}

#main-content {

overflow:scroll;

height:100px;

width:960px;

margin:0 auto;

padding:130px 0;

border-style:dashed;

border-width:1;

}

#navigation, #paging {

width:960px;

margin:0 auto;

}

Untitled PageNavigation goes hereSection content goes here

Section content goes here

Section content goes here

Section content goes here

Section content goes here

Section content goes here

Section content goes here

Section content goes here

Section content goes here

Section content goes here

Section content goes here

Section content goes here

Section content goes here

Section content goes here

Section content goes here

Paging controls go here

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。