javascript backgroundRepeat property


  Translation results:

background

UK[ˈbækgraʊnd] US[ˈbækˌɡraʊnd]

n. (painting, etc.) background; background color; background information; soundtrack

Plural: backgrounds

repeat

英[rɪˈpi:t] 美[rɪˈpit]

vt. Repeat; retell, recite

vi.Redo; repeat voting

n.Repetition; (program) reenactment; repeated things

Third person singular: repeats Plural: repeats Present participle: repeating Past tense: repeated Past participle: repeated

javascript backgroundRepeat propertysyntax

Function:Set whether and how the background image is repeated.

Syntax: Object.style.backgroundRepeat=repeat_value

Parameters: repeat Default. The background image will repeat vertically and horizontally. Repeat-x The background image will be repeated horizontally. repeat-y The background image will be repeated vertically. no-repeat The background image will be displayed only once.​

javascript backgroundRepeat propertyexample

<html>
<head>
<style type="text/css">
body
{
background-color:#FFCC80;
background-image:url(http://img.php.cn/upload/article/000/005/656/5af270fd37755429.jpg);
}
</style>
<script type="text/javascript">
function changeRepeat()
{
document.body.style.backgroundRepeat="repeat-y";
}
</script>
</head>
<body>

<input type="button" onclick="changeRepeat()"
value="Repeat background-image only on the y-axis" />

</body>
</html>

Run instance »

Click the "Run instance" button to view the online instance

Home

Videos

Q&A