The CSS reference

"background-repeat" - css property (v. css 1)

  • If a background image is specified, the value of 'background-repeat' determines how/if the image is repeated.
  • Initial value: repeat
  • The property is not inherited
  • HTML usage: all elements
  • Browsers that support the background-repeat - property :
    Internet Explorer Mozilla Firefox Opera Google Chrome Apple Safari

Possible property values:

Values Comments CSS
repeat The image is repeated both horizontally and vertically. 1
repeat-x The image is repeated horizontally only. 1
repeat-y The image is repeated vertically only. 1
no-repeat The image is not repeated: only one copy of the image is drawn. 1
inherit Will inherit the value from parent specification. This property value is new with CSS 2. 2

Property "background-repeat" example:

<html>
<head>
<style type="text/css">
  body { background-image: url(images/Trophy.png);
         background-color: #cdcdcd; 
	 background-repeat: no-repeat;}
</style>
</head>
<body>
</body>
</html>

Javascript access:

// To SET values ([o] is the target object) 
[o].style.backgroundRepeat="background-repeat value"
// To GET values you must first get the computed style object
// To get that object in IE or Opera:
var cStyle=[o].currentStyle;
// To get that object in Firefox, Chrome or Safari (w3c-type):
var cStyle=window.getComputedStyle([o],null);
// To GET the property value:
var value=cStyle.backgroundRepeat;
© 2010 by Finnesand Data. All rights reserved.
This site aims to provide FREE programming training and technics.
Finnesand Data as site owner gives no warranty for the correctness in the pages or source codes.
The risk of using this web-site pages or any program codes from this website is entirely at the individual user.