CSS - background-image
background-image
sets the background image of an element
Property Variable Name
background-image
Available Values for background-image
url(https://css.kruxor.com/images/pexels-photo-4279015.jpeg)|none|initial|inherit
Examples Using background-image values
Example using background-image url(https://css.kruxor.com/images/pexels-photo-4279015.jpeg)
Example using background-image url(https://css.kruxor.com/images/pexels-photo-4279015.jpeg)
Here is an example using background-image:url(https://css.kruxor.com/images/pexels-photo-4279015.jpeg);
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-size:cover;
background-image:url(https://css.kruxor.com/images/pexels-photo-4279015.jpeg);
}
</style>
<h2>Example using background-image url(https://css.kruxor.com/images/pexels-photo-4279015.jpeg)</h2>
<p>Here is an example using <code>background-image:url(https://css.kruxor.com/images/pexels-photo-4279015.jpeg);</code></p>
<div class='demo-box-1'>
</div>
Example using background-image none
Example using background-image none
Here is an example using background-image:none;
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-size:cover;
background-image:none;
}
</style>
<h2>Example using background-image none</h2>
<p>Here is an example using <code>background-image:none;</code></p>
<div class='demo-box-2'>
</div>
Example using background-image initial
Example using background-image initial
Here is an example using background-image:initial;
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-size:cover;
background-image:initial;
}
</style>
<h2>Example using background-image initial</h2>
<p>Here is an example using <code>background-image:initial;</code></p>
<div class='demo-box-3'>
</div>
Example using background-image inherit
Example using background-image inherit
Here is an example using background-image:inherit;
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-size:cover;
background-image:inherit;
}
</style>
<h2>Example using background-image inherit</h2>
<p>Here is an example using <code>background-image:inherit;</code></p>
<div class='demo-box-4'>
</div>