how to add background image in css from local folder code example

Example 1: background image syntax in css if it is in folder

/* 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');

Example 2: how to set background image for web page in html local image

body {  background-image: url(/path/to/image.png); }

Example 3: background image syntax in css if it in folder

body {
  background: radial-gradient(circle, black, white);
}

Tags:

Css Example