insert image in css code code example

Example 1: how to add an image in css

.element {
  background-image: url("imageFile.png");
}

Example 2: insert image by css

div.mydiv:after {
  content: url(image.jpg); /*url of your image*/
}

or

div.mydiv {
   width:100px; /*width of your image*/
   height:100px; /*height of your image*/
   background-image:url('image.file');
}

Example 3: add image to css

background-image: url(path);
background-repeat: no-repeat;
width: 10px;
height: 20px;

Example 4: css add image

background-image: url("imageFile.png");

Tags:

Css Example