作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在制作一个基于不使用 DIV
的模板,但我在页脚方面遇到了问题。我想知道我是否可以有一个 100% 宽度的页脚(有点像 stackoverflow),它实际上粘在底部,在添加更多内容并保持背景颜色时不会修复或 overflow hidden 。
这可能吗?
我的 Fiddle .
header, article {
margin: 0 auto;
display:block;
width:500px
}
html, body {
height:100%
}
body {
min-height:100%;
margin:0
}
header, article, section {
text-align:left;
font:normal 1em Verdana, sans-serif;
color:black
}
footer {
position:absolute;
bottom:0;
height:200px;
width:100%;
background:grey
}
footer p {
text-align:left;
font:normal 1em Verdana, sans-serif;
color:white
}
footer article {
height:50px;
width:100%
}
footer section {
background:black;
height:50px;
width:100%
}
footer section p {
text-align:left;
font:normal 1em Verdana, sans-serif;
color:white
}
header, article {
margin: 0 auto;
display:block;
width:500px
}
html, body {
height:100%
}
body {
min-height:100%;
margin:0
}
header, article, section {
text-align:left;
font:normal 1em Verdana, sans-serif;
color:black
}
footer {
position:absolute;
bottom:0;
height:200px;
width:100%;
background:grey
}
footer p {
text-align:left;
font:normal 1em Verdana, sans-serif;
color:white
}
footer article {
height:50px;
width:100%
}
footer section {
background:black;
height:50px;
width:100%
}
footer section p {
text-align:left;
font:normal 1em Verdana, sans-serif;
color:white
}
最佳答案
我有一个示例,其中页脚是 fixed
并使用 body:after 添加填充以使其可滚动。
jsfiddle:http://jsfiddle.net/wk8Jf/3/
或者如果你想滚动页面:
jsfiddle:http://jsfiddle.net/wk8Jf/5/
关于html - 100% 没有 div 的页脚,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17624461/
我是一名优秀的程序员,十分优秀!