Javascript examples for CSS Style Property:backgroundRepeat
The backgroundRepeat property sets or gets how to repeat a background-image.
Value | Description |
---|---|
repeat | Default. repeated both vertically and horizontally. |
repeat-x | repeated horizontally |
repeat-y | repeated vertically |
no-repeat | not repeated |
initial | Sets this property to its default value. |
inherit | Inherits this property from its parent element. |
Item | Value |
---|---|
Default Value: | repeat |
Return Value: | A String, representing how a background-image is repeated |
CSS Version | CSS1 |
Get a background-image
<!DOCTYPE html> <html> <body style="background:#f3f3f3 url('http://java2s.com/resources/a.png');background-repeat:repeat-y;"> <h1>Hello World!</h1> <button type="button" onclick="myFunction()">Get background-repeat value</button> <script> function myFunction() {//ww w .j a v a 2 s .c o m console.log(document.body.style.backgroundRepeat); } </script> </body> </html>