html 有时页面较短 页脚往上跑很难看,html - 为什么页脚上的CSS边框将页面推到100%以上 - 堆栈内存溢出...

我正在使用此方法将页脚正确地放在页面底部。

但是,当在页脚中添加边框时,无论屏幕上的内容如何,​​最终都会出现滚动条。 我的困惑是:

我认为边框在填充外部但在边距内部起作用,因此像填充一样,它们不会影响div外部的任何布局 。

错了吗

这是我的基本HTML:

这是相关的CSS:

#top

{

height: 105px;

border-bottom-style: solid;

border-bottom-color: #044E97;

border-bottom-width: 7px;

}

#body

{

margin-top: 25px;

width: 100%;

background-color: white;

color: #282828;

font-size: 85%;

}

#box1

{

width: 460px;

float: left;

margin-left: 25px;

margin-right:75px;

}

#box2

{

margin-left: 25px;

margin-top: 15px;

padding-top: 0%;

padding-bottom:0%;

margin-bottom:45px;

width: 350px;

height: 320px;

float:left;

border-top-style: solid;

border-top-color: #FFFFFF;

border-top-width: 10px;

}

html

{

height: 100%;

}

body

{

min-height: 100%;

background-color: white;

margin: 0;

}

html, body

{

min-height:100%;

position:relative;

}

.wrapper

{

min-height: 100%;

height: auto !important;

height: 100%;

margin: 0 auto -3em;

}

.footer, .push

{

height: 3em;

clear: both;

}

.footer

{

width:100%;

background-color: #0563A1;

border-top-style: solid;

border-top-color: #044E91;

border-top-width: 8px;

color: white;

font-size: 77%;

padding-top:.3em;

padding-bottom:.3em;

}

如果将页脚div更改为没有填充,滚动条将清除。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值