image in css code example

Example 1: how to add an image in css

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

Example 2: how to add image with url in css

background-image: url('images/my-image.png');

Example 3: add image to css

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

Example 4: image size css

img {
  width: width;
  height: height;
}

Example 5: comment in css

/* There is just single way to comment in css and its just 
like this:
/* your comment content*/

Example 6: css add image

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

Tags:

Html Example