0

EasyCareBath.comにフッターを追加しましたが、「。footer_box」を除いてdivを正しく機能させることができます。中央に配置されません。「左:15%」を追加しましたが、ウィンドウを爆破すると、整列しなくなります。私は何かが足りないのですか、それともCSSにやりすぎましたか?

.footer_spacer {
    height: 50px;   
}
.footer_wrapper {
    height: 375px;
    background-color: #e6dccb;
}
.footer {
    border-top: 10px solid #789E65;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.6);
    margin-top: 0px;
    /*min-width: 1007px;*/
    height: 235px;
    background-attachment: scroll;
    background-image: url(../images_footer/footer_bg.png);
    background-repeat: repeat-x;
    background-position: center top;
    position: relative;
}
.footer_box {
    height: 236px;
    width: 1007px;
    /*position: relative;*/
}
.footer_copyright {
    width: 100%;
    /* [disabled]height: 100px; */
    /*float: left;*/
    padding-top: 15px;
    position: relative;
    text-align: center;
    word-spacing: normal;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 14px;
    font-weight: 100;
    font-variant: normal;
    text-transform: none;
    color: #354245;
}
#footer_col_01 {
    position:absolute;
    left:11px;
    top:3px;
    width:164px;
    /*height:230px;*/
    z-index:1;
}
#footer_col_02 {
    position:absolute;
    left:186px;
    top:3px;
    width:164px;
    /*height:230px;*/
    z-index:1;
}
#footer_col_03 {
    position:absolute;
    left:361px;
    top:3px;
    width:164px;
    /*height:230px;*/
    z-index:1;
}
#footer_col_04 {
    position:absolute;
    left:535px;
    top:3px;
    width:183px;
    /*height:230px;*/
    z-index:1;
}
#footer_col_05 {
    position:absolute;
    left:728px;
    top:3px;
    width:265px;
    /*height:230px;*/
    z-index:1;
    font-size: 14px;
}
footer {
    font-family: Arial, Helvetica, sans-serif;
    color: #fff;
    font-size: 11px;
    float: left;
    width: 100%;
}
footer a {
    color: #FFF;
    text-decoration: none;
}
footer a:hover {
    color: #FFF;
    text-decoration: underline;
}
footer h6 {
    font-family: Arial, Helvetica, sans-serif;
    font-size: 16px;
    font-weight: 500;
    color: #00A1CC;
    line-height: 46px;
    /*margin-bottom: -2px;*/
}
footer li {
    line-height: 18px;
    list-style-type: none;
    margin-left: 12px;
}
.footer_img_center {
    text-align: center;
}
4

3 に答える 3

5

ルール.footer_boxを次のように変更します。

.footer_box {
    height: 236px;
    width: 1007px;
    margin: 0 auto;
    position: relative;
    }

margin: 0 auto;フッターボックスを中央に配置します。

position: relative;絶対に配置された列が本体ではなくベースに配置されるようにfooter_boxなります。

サイドノート/私がいつも好きだったアナロジー:「auto」は、ページの端に接続されたアイテムのその側に輪ゴムを取り付けることと考えてください...この場合、「auto」は右側にあり、左なので、左と右の両方から輪ゴムが引っ張られている場合は、画面のサイズに関係なく、常に中央に配置されます。

于 2012-11-15T15:30:29.130 に答える
1

次のようにcssを修正します。

.footer_box {
    height: 236px;
    margin: 0 auto;
    position: relative;
    width: 1007px;
}
于 2012-11-15T15:30:48.430 に答える
1

あなたは正しい方向に進んでいました:

.footer_box {
    height: 236px;
    width: 1007px;
    position: relative;
    margin: 0px auto;
}

左右の自動マージンにより、画面サイズに関係なく、フッターが常に中央に配置されます。

于 2012-11-15T15:32:19.487 に答える