Div Background Image

Div Background Image

Many times you want to add background image to div. Here is simplest tutorial to do so. We are using background-image property of style. A Div below is 500px wide and 500px in height. It is referring my Google plus image. For demo purpose feel free to use it in your code.

Div Background Image Example


    <title>div background image</title>
<div class="divBackOne">
This is div with background image

You can also position background image at top bottom or top right etc.
Use background-position:right top; in CSS.

To repeat background image on X axis use background-repeat:repeat-x;

Similarly, you can repeat image on Y axis use background-repeat:repeat-Y;