how to attach image to background css code example

Example 1: using css how do you put a background image

background-image: url("image.png");
background-position: center;
background-repeat: no-repeat;
background-size: cover;

Example 2: CSS adding background image from file

/* The first method using an image on your server */
background: url('img/someimage.jpg');

/* The second method using an image hosted on another server */
background: url('http://www.someimage.com/someimage.jpg');

/* A third method that allows the site to determine protocol instead of explicitly defining it */
background: url('//www.someimage.com/someimage.jpg');

Tags:

Css Example