background-repeat property
Specifies how to tile the background-image relative to the upper-left corner of the container object.
With this property you have control over how the image is repeated (repeats vertically, horizontally, in both or in neither direction).

JavaScript page for this property: backgroundRepeat. You can find other example(s) there. |
Possible values:

Takes the value of this property from the computed style of the parent element. | |||||||
Image is not repeated. | |||||||
Default. Image is repeated both horizontally and vertically. | |||||||
Image is only repeated horizontally. | |||||||
Image is only repeated vertically. |
Default: repeat.
Example HTML code 1:
This example illustrates the use of the background-repeat property:
|
||||
<head> <style> .example { background-image: url("picture.gif"); background-repeat: repeat; width: 200px; height: 200px; } </style> </head> <body> <div class="example"> The background image, <br /> behind this element <br /> is repeated vertically <br /> and horizontally, too. </div> </body> |
||||
|
||||
Did you find this example helpful?
|
Example HTML code 2:
This example illustrates all available repetitions of the background image in action:
|
||||
<head> <style> .example { background-image: url("picture.gif"); background-repeat: repeat; width: 200px; height: 120px; border:1px solid #CCCCCC; } .norepeat { background-repeat: no-repeat; } .repeatX { background-repeat: repeat-x; } .repeatY { background-repeat: repeat-y; } </style> </head> <body> <div class="example norepeat"> The background image <br /> behind this element <br /> is not repeated <br /> in any direction. </div> <br /> <div class="example repeatX"> The background image <br /> behind this element <br /> is repeated only <br /> in horizontal direction. </div> <br /> <div class="example repeatY"> The background image <br /> behind this element <br /> is repeated only <br /> in vertical direction. </div> <br /> <div class="example"> The background image <br /> behind this element <br /> is repeated in both <br /> directions. </div> </body> |
||||
|
||||
Did you find this example helpful?
|
Supported by tags:
a, abbr, acronym, address, b, bdo, big, blink, blockQuote, body, button, caption, center, cite, code, col, colGroup, dd, del, dfn, dir, div, dl, dt, em, fieldSet, font, form, frame, frameSet, H1, H2, H3, H4, H5, H6, hr, html, i, iframe, img, input:button, input:checkbox, input:file, input:image, input:password, input:radio, input:range, input:reset, input:search, input:submit, input:text, ins, isIndex, kbd, label, legend, li, listing, marquee, menu, nobr, ol, p, plainText, pre, q, rt, ruby, s, samp, select, small, span, strike, strong, sub, sup, table, tBody, td, textArea, tFoot, th, tHead, tr, tt, u, ul, var, xmp
Related pages:
background
background-attachment
background-color
background-image
background-position
background-position-x
background-position-y
background-attachment
background-color
background-image
background-position
background-position-x
background-position-y
External links:
background-repeat (MSDN)
background-repeat (Mozilla Developer Center)
background-repeat (Safari Reference Library)
background-repeat (W3C)
background-repeat (Mozilla Developer Center)
background-repeat (Safari Reference Library)
background-repeat (W3C)
User Contributed Comments