html - 列表对齐方式错误

标签 html css

这是我的HTML

<div id="footer">
    <div id="footer_content">
           &#169; 2012 Company, Inc.
           <ul>
                <li><a href="/contact">Contact</a></li>
                <li><a href="/terms">Terms</a></li>
                <li><a href="/privacy">Privacy</a></li>
           </ul>
    </div>
</div>​

这是我的CSS

/* FOOTER */ 
#footer {
    position: relative; 
    margin-top: -60px; 
    text-size:12px; 
    height: 60px; 
    clear:both; 
    background-color: blue; 
    line-height: 60px; 
    text-align:right
} 
#footer_content { 
    width: 940px; 
    margin: 0 auto;
}
#footer ul { 
    list-style: none; 
    position: absolute; 
    top: 0px; 
}
#footer ul li { 
    float: left; 
    margin-right: 5px; 
}
#footer ul li a { 
    font-weight: bold; 
    margin-right: 5px; 
    text-decoration: none; 
}
#footer ul li a:hover {  }​

目前版权在右,链接在左。应该是反过来的。您打算做出什么调整来移动它们?

最佳答案

我非常同意 Space Beers 所说的,但有一些方法可以改进这一点。

HTML:

    <div id="footer">
        <div id="footer_content">
           <ul>
               <li><a href="/contact">Contact</a></li>
               <li><a href="/terms">Terms</a></li>
               <li><a href="/privacy">Privacy</a></li>
           </ul>
           <div class="copyright">
               &#169; 2012 Company, Inc.
           </div>
        </div>
    </div>​

CSS:

    #footer {
        position: relative; 
        margin-top: -60px; 
        text-size:12px; 
        height: 60px;
        background-color: blue; 
        line-height: 60px; 
        text-align:right
    } 
    #footer_content { 
        width: 940px; 
        margin: 0 auto;
    }
    #footer ul { 
        float:right;
        list-style: none; 
    }
    #footer ul li { 
        display:block;
        float: left; 
        margin-right: 5px; 
    }
    #footer ul li a { 
        font-weight: bold; 
        margin-right: 5px; 
        text-decoration: none; 
    }

    #footer .copyright{
        float:left;
    }

这应该是完全浏览器兼容的。

关于html - 列表对齐方式错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12918015/

相关文章:

html - CSS 多浏览器中的 Aqua 按钮

javascript - 24 小时时间自动正则表达式

html - 为什么 100% 高度和 100% 宽度在我的 ASPX 页面中不起作用?

html - Dreamweaver css id 和类生成

css - 没有将 nil 隐式转换为 String

html - MediaWiki 模板表条件列

javascript - HTML5 视频重定向

css - 如何仅在移动设备上使一个 div 超过两个 div

css - Bootstrap 4垂直对齐div的中心和底部

javascript - onclick() 和 .on ('click' ,function()) 之间的区别?