CSS-将页脚背景图像居中

CSS-将页脚背景图像居中,css,Css,在我的MVC应用程序中,我在每个页面上都有一个包含图像的页脚。如果可能的话,我想将图像居中。我当前的CSS如下所示: footer { position:absolute; bottom:-150px; /* This puts the footer 100px below the bottom of the page*/ width:70%; height:175px; /* Height of the footer */ background-im

在我的MVC应用程序中,我在每个页面上都有一个包含图像的页脚。如果可能的话,我想将图像居中。我当前的CSS如下所示:

footer {
    position:absolute;
    bottom:-150px; /* This puts the footer 100px below the bottom of the page*/
    width:70%;
    height:175px;   /* Height of the footer */
    background-image: url("/Images/Footer/Footer3.png");
    background-repeat: no-repeat;
    border-top: 1px solid darkgray;
}

我需要添加什么以使图像居中?

您需要添加
背景位置
属性,如:

另见


您需要添加
背景位置
属性,如:

另见

footer {
    position:absolute;
    bottom:-150px; /* This puts the footer 100px below the bottom of the page*/
    width:70%;
    height:175px;   /* Height of the footer */
    background-position: center;
    background-image: url("/Images/Footer/Footer3.png");
    background-repeat: no-repeat;
    border-top: 1px solid darkgray;
}