CSS Background

You can add background to your element using background keyword. A background can be a background color or a background image. When using a background image, the construction will be: background: url(url-here).

#div1 {
   background: green;
}
#div2 {
   background: url(/resources/images/bg2.jpg);
}
div {
   width: 250px;
   height: 250px;
   color: #FFF;
}
<div id="div1">Green Background</div>
<div id="div2">Image Background</div>
Output
Green Background
Image Background
Share this tutorial!