shiyanwu 发表于 2013-1-29 07:32:33

css 中footer的设置

#footer {
    margin: 0px auto;
    position: relative;
    background-color: #717F51;
    border-top: 9px solid #F7F7F6;
    width: 692px;
    padding: 5px 0;
    clear: both;
}

Clear属性用于清除浮动,简单点说就是在其左边或右边不允许有任何浮动元素。margin: 0px auto的语法在之前的教程中已经出现过了,其作用就是让页脚在页面中居中显示。为了不让页脚文字和边框贴得太近,我们用padding在上、下空出5px的填充空间

#footer h2 {
    maring: 0;
    text-align: center;
    font: normal 10px Verdana, Arial, Helvetica, sans-serif;
    color: #D3D8C4;
}
#footer h2 a:visited, #footer h2 a:link {
    color: #D3D8C4;
    text-decoration: none;
    border-bottom: 1px dotted #D3D8C4;
}
#footer h2 a:hover {
    color: #F7F7F6;
    text-decoration: none;
    border-bottom: none;
    background-color: #A5003B;
}
页: [1]
查看完整版本: css 中footer的设置