linear gradient css background image code example

Example 1: background with image and gradient

body {
  background: #eb01a5;
  background-image: url("IMAGE_URL"); /* fallback */
  background-image: url("IMAGE_URL"), linear-gradient(#eb01a5, #d13531); /* W3C */
}

Example 2: linear gradient css background image

background-image: url("IMAGE_URL"), linear-gradient(#eb01a5, #d13531);

Example 3: css horizontal linear gradient

background: linear-gradient(to left, red, blue);

Example 4: linear-gradient

background: linear-gradient(to left, #333, #333 50%, #eee 100%);

Example 5: background-image linear-gradient url

body {
    background-image: url("http://www.skrenta.com/images/stackoverflow.jpg"), linear-gradient(red, yellow);
    background-image: url("http://www.skrenta.com/images/stackoverflow.jpg"), -webkit-gradient(linear, left top, left bottom, from(red), to(yellow));
    background-image: url("http://www.skrenta.com/images/stackoverflow.jpg"), -moz-linear-gradient(top, red, yellow);
  }

Example 6: css horizontal gradient background color

.foo {
	background-image: linear-gradient(red, blue);
}

Tags:

Css Example