background-repeat

In this chapter you will learn:

  1. background-repeat

background-repeat

You can specify a value for both the horizontal and vertical repeats. If you provide only one value, the browser will use that repeat style in both directions.

The background-repeat values are:

ValueDescription
repeat-xRepeats the image horizontally and the image may be fragmented.
repeat-yRepeats the image vertically and the image may be fragmented.
repeatRepeats the image in both directions and the image may be fragmented.
spaceThe image is repeated to fill the space without creating fragments.
roundThe image is scaled to repeat without creating fragments.
no-repeatThe image is not repeated.
<!DOCTYPE HTML> <!--  j  av a  2  s  .  c o m-->
<html> 
    <head> 
        <style type="text/css"> 
        p { 
            background-image: url(http://java2s.com/style/download.png); 
            background-repeat: repeat-x; 
        } 
        </style> 
    </head> 
    <body> 
        <p> 
            HyperText Markup Language (HTML) is the main markup language for 
            displaying web pages and other information that can be displayed 
            in a web browser(From From Wikipedia, the free encyclopedia).
        </p> 
    </body> 
</html>

Click to view the demo

Next chapter...

What you will learn in the next chapter:

  1. background-size
  2. How to make the background image to cover
Home » HTML CSS Tutorial » CSS Reference
background
background-clip
background-color
background-origin
background-position
background-repeat
background-size
border
border-bottom
border-bottom-color
border-bottom-left-radius
border-bottom-right-radius
border-bottom-style
border-bottom-width
border-collapse
border-color
border-left
border-left-color
border-left-style
border-left-width
border-radius
border-right
border-right-color
border-right-style
border-right-width
border-spacing
border-style
border-top
border-top-color
border-top-left-radius
border-top-right-radius
border-top-style
border-top-width
border-width
bottom
caption-side
clear
color
content
counter-increment
counter-reset
cursor
direction
display
empty-cells
float
font
font-family
font-size
font-style
font-variant
font-weight
height
left
letter-spacing
line-height
list-style
list-style-image
list-style-position
list-style-type
margin
margin-bottom
margin-left
margin-right
margin-top
max-height
max-width
min-height
min-width
opacity
outline
outline-color
outline-offset
outline-style
outline-width
overflow
overflow-x
overflow-y
padding
padding-bottom
padding-left
padding-right
padding-top
position
quotes
right
table-layout
text-align
text-decoration
text-indent
text-overflow
text-shadow
text-transform
top
vertical-align
visibility
white-space
width
word-spacing
z-index