CSS Background Repeat

Topic

How to set the background image with out repeating in html?
Repeat background image in vertical direction only.
Repeat background image in horizontal direction only.

Explanation

This tag sets the property of how the background image should look.
Depending on this tag the image might repeat in horizontal or vertical or both directions
It takes any of the following values.
a) repeat : This value tells the image to be repeated in both directions
b) repeat-x : This value tells the image to be repeated in vertical direction only
c) repeat-y : This value tells the image to be repeated in horizontal directions
d) no-repeat : This value tells that the background image should not be repeated

Examples


Example 1:


<div style="background-image: url('test3.jpg'); background-repeat: repeat; background-color: green;"> color name <br><br><br></div>
Result:

color name


Example 2:


<div style="background-image: url('test3.jpg'); background-repeat: repeat-x; background-color: green;"> color name <br><br><br></div>
Result:

color name


Example 3:


<div style="background-image: url('test3.jpg'); background-repeat: repeat-y; background-color: green;"> color name <br><br><br></div>
Result:

color name


Example 4:


<div style="background-image: url('test3.jpg'); background-repeat: no-repeat; background-color: green;"> color name <br><br><br></div>
Result:

color name


Now you can see that the image test has been set as background for the div tag.
Depending on the repeat tag the image gets itself repeated inside the space.