可以通過增加footer
延長頁腳到屏幕的整個寬度在你想保留的容器上使用:
.list-container + .list-container {
float: right;
}
請參見下面的演示:
* {
margin: 0;
padding: 0;
}
footer {
background: #eee;
height: 50px;
position: fixed;
bottom: 0;
left: 0; /* ADDED */
right: 0; /* ADDED */
border: solid 5px red;
}
footer ul {
line-height: 50px;
}
.list-container {
display: inline-block;
}
footer ul li {
display: inline-block;
margin-right: 10px;
}
#list-1 {
padding-left: 15px;
}
#list-2 {
position: relative;
/*left: 835px;*/
}
.list-container + .list-container {
float: right; /* ADDED */
}
<html>
<head>
<title>Fake Google Homepage</title>
<link rel="stylesheet" type="text/css" href="fakeGoogle.css">
<!--[if IE]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
</head>
<body>
<footer>
<div class="list-container">
<ul id="list-1">
<li>Advertising</li>
<li>Business</li>
<li>About</li>
</ul>
</div>
<div class="list-container">
<ul id="list-2">
<li>Privacy</li>
<li>Terms</li>
<li>Settings</li>
<li>Use Google.com</li>
</ul>
</div>
</footer>
</body>
</html>
爲什麼你有'離開:835px'在'列表2'? – kukkuz
使第二個列表顯示在屏幕的右側。我希望第一個列表顯示在最下面的角落,第二個列表顯示在右下角。 – Yousaf