CSS - Centering a footer background image -


in mvc app, have footer on each page containing image. i'd center image if possible. current css looks follows:

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

what need add center image?

you need add background-position property like:

see here

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

Comments

Popular posts from this blog

java - unable show chart in xls document using jasper reports -

java.lang.RuntimeException: Could not generate dummy secret at sun.security.ssl.RSAClientKeyExchange.<init> -

javascript - How to change image src on success AJAX -