css浮动页脚边距

时间:2010-08-08 17:01:43

标签: css sticky-footer

我正在尝试修改粘性页脚(http://www.cssstickyfooter.com/)以显示边距...右侧和左侧宽度很容易:90%和边距:自动

| |    | |
| |    | |
| |    | |
| |    | |

但如何在不弄乱浮动页脚的情况下将高度设置为90%(或显示某种顶部和底部边距)

|  ____  |
| |    | |
| |____| |
|        |

感谢

body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,form,fieldset,input,
textarea,p,blockquote,th,td { 
    margin:0;
    padding:0;
}
#header {
    height: 33px;
    line-height: 33px;
    text-align: center;
    background-color: green;
}
html { height: 100%; }
body { height: 100%; width: 90%; margin: auto; }
#wrap { min-height: 100%; background-color:gray; }
#main {
    overflow: auto;
    padding-bottom: 33px; /* must be same height as the footer */
    background-color: red;
    height: 100%;
}
#footer {
    position: relative;
    margin-top: -33px; /* negative value of footer height */
    height: 33px;
    line-height: 33px;
    text-align: center;
    background-color:blue;
}
​

http://jsfiddle.net/56REF/

1 个答案:

答案 0 :(得分:2)

这会满足您的需求吗? http://jsfiddle.net/CZayc/