CSS - background-repeat
background-repeat
background-repeat controls how and which directions the background image should repeat (or not)
Property Variable Name
background-repeat
Available Values for background-repeat
repeat|repeat-x|repeat-y|no-repeat|initial|inherit
Examples Using background-repeat values
Example using background-repeat repeat
Example using background-repeat repeat
Here is an example using background-repeat:repeat;
Code
<style>
.demo-box-1 {
border-radius:3px;
margin-bottom:10px;
border:1px solid #000;
height:220px;
width:100%;
display: flex;
flex-wrap: wrap;
background:url(https://css.kruxor.com/images/pexels-johannes-rapprich-4996652-1200.jpg);
background-repeat:repeat;
}
</style>
<h2>Example using background-repeat repeat</h2>
<p>Here is an example using <code>background-repeat:repeat;</code></p>
<div class='demo-box-1'>
</div>
Example using background-repeat repeat-x
Example using background-repeat repeat-x
Here is an example using background-repeat:repeat-x;
Code
<style>
.demo-box-2 {
border-radius:3px;
margin-bottom:10px;
border:1px solid #000;
height:220px;
width:100%;
display: flex;
flex-wrap: wrap;
background:url(https://css.kruxor.com/images/pexels-johannes-rapprich-4996652-1200.jpg);
background-repeat:repeat-x;
}
</style>
<h2>Example using background-repeat repeat-x</h2>
<p>Here is an example using <code>background-repeat:repeat-x;</code></p>
<div class='demo-box-2'>
</div>
Example using background-repeat repeat-y
Example using background-repeat repeat-y
Here is an example using background-repeat:repeat-y;
Code
<style>
.demo-box-3 {
border-radius:3px;
margin-bottom:10px;
border:1px solid #000;
height:220px;
width:100%;
display: flex;
flex-wrap: wrap;
background:url(https://css.kruxor.com/images/pexels-johannes-rapprich-4996652-1200.jpg);
background-repeat:repeat-y;
}
</style>
<h2>Example using background-repeat repeat-y</h2>
<p>Here is an example using <code>background-repeat:repeat-y;</code></p>
<div class='demo-box-3'>
</div>
Example using background-repeat no-repeat
Example using background-repeat no-repeat
Here is an example using background-repeat:no-repeat;
Code
<style>
.demo-box-4 {
border-radius:3px;
margin-bottom:10px;
border:1px solid #000;
height:220px;
width:100%;
display: flex;
flex-wrap: wrap;
background:url(https://css.kruxor.com/images/pexels-johannes-rapprich-4996652-1200.jpg);
background-repeat:no-repeat;
}
</style>
<h2>Example using background-repeat no-repeat</h2>
<p>Here is an example using <code>background-repeat:no-repeat;</code></p>
<div class='demo-box-4'>
</div>
Example using background-repeat initial
Example using background-repeat initial
Here is an example using background-repeat:initial;
Code
<style>
.demo-box-5 {
border-radius:3px;
margin-bottom:10px;
border:1px solid #000;
height:220px;
width:100%;
display: flex;
flex-wrap: wrap;
background:url(https://css.kruxor.com/images/pexels-johannes-rapprich-4996652-1200.jpg);
background-repeat:initial;
}
</style>
<h2>Example using background-repeat initial</h2>
<p>Here is an example using <code>background-repeat:initial;</code></p>
<div class='demo-box-5'>
</div>
Example using background-repeat inherit
Example using background-repeat inherit
Here is an example using background-repeat:inherit;
Code
<style>
.demo-box-6 {
border-radius:3px;
margin-bottom:10px;
border:1px solid #000;
height:220px;
width:100%;
display: flex;
flex-wrap: wrap;
background:url(https://css.kruxor.com/images/pexels-johannes-rapprich-4996652-1200.jpg);
background-repeat:inherit;
}
</style>
<h2>Example using background-repeat inherit</h2>
<p>Here is an example using <code>background-repeat:inherit;</code></p>
<div class='demo-box-6'>
</div>