The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS How to centre a Background image

  • This topic is empty.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
  • #43070

    Hi New here and to CSS. I have looked everywhere but can’t find or work out how to centre a background image.
    I have a header and want to use an image as the background. I have set the background image and tried using left and right margin as auto. However the image always goes to the left. I want to use it for a mobile site, and just need a small image to be in the centre. I am using Dreamweaver CS6 on a mac.

    Any help would be appreciated.


    You should try this:

    element(your header) {
    background: url(imagepath/bg.png) no-repeat center center;


    Many thanks….. you’re a genius


    [You might also look at this implementation](

Viewing 4 posts - 1 through 4 (of 4 total)
  • The forum ‘CSS’ is closed to new topics and replies.