CSS Tutorial





Español Français 中文 Deutsch Portuguese Japanese nederlands
   
 
CSS Topics
css tutorials Introduction
Types Types
Background Properties Background Properties
Text Properties Text Properties
Font Properties Font Properties
Box Properties BOX Properties
Border Properties Border Properties
Margin Properties Margin Properties
Padding Properties Padding Properties
Special Topics Special Topics
Forums Ask Your Doubts
Scraps More about CSS
Feedback Feedback
 

CSS Background Repeat


Tutorials Css

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.


Background image Background position


A Note
CSS - Cascading Style Sheets can be used along with html tags as explained in this site. This simple CSS will help you to create much elegant and neat html web pages. This does not need any additional softwares or codings. All web browser are capable of handing CSS codes.

Note 2: If required you can using <span> instead of <div> tags. div tag will start and end on new lines. span will not exceed the tag area.
Other Links

web hosting