» Snippets » css » Set an image center of web page background using css

Set an image center of web page background using css

  • Using css you can easily set an image in the middle of your web page background. There are several ways to do that. Today I'm going to show you most simplest way to set an image center of the web page background.

    - Write a simple CSS Class:

    div.centered-image{
        width: 100%;
        height: 100%;
        background: url('image.png') center center no-repeat;
    } 

    - Write a simple HTML

    Create a div and add "centered-image" class. Very simple!

    <div class="centered-image"></div>

     

    Demo

Previous tutorial No Preious Post Available!

Publish your snippets with us & be an exclusive author!

  • Total View: 311 time(s)
  • Script Upload Date: 2012-07-02

Recommended Scripts More Recommended Snippets: