5

私は次のページレイアウトを持っています:

<header></header>
<div id="content"></div>
<aside></aside>
<footer>
 <ul>
  <li></li>
 </ul>
</footer>

ここで、フッターを正確に左隅に配置します。

text-align: left;
position: fixed;
bottom: 0;
margin: -16px -8px;

今は負のマージンであり、最善の解決策ではありません。フッターをコーナーに直接配置するためのより良い方法はありますか?

よろしく

4

4 に答える 4

22

このように書く:

text-align: left;
position: fixed;
bottom: 0;
left:0
于 2012-04-25T13:15:37.733 に答える
7

このサイトをチェックするスティッキーフッター

例:

* {
    margin: 0;
}
html, body {
    height: 100%;
}
.wrapper {
    min-height: 100%;
    height: auto !important;
    height: 100%;
    margin: 0 auto -142px; /* the bottom margin is the negative value of the footer's height */
}
.footer, .push {
    height: 142px; /* .push must be the same height as .footer */
}
于 2012-04-25T13:16:51.597 に答える
1

私にとっては、次のように機能します。

height: 58px;
position:relative;
bottom: -58px;

heightとの同じ値に注意してくださいbottom。そしてpostionrelative

于 2013-05-31T02:02:24.840 に答える
0

HTML:

<div id="footer"></div>

CSS:

#footer {
   position:absolute;
   bottom:0;
   width:100%;
   height:60px;   /* Height of the footer */
   background:#6cf;
}
于 2014-02-22T12:27:04.477 に答える