Skip to main content

Background and Image

The Background Property

image

#product-overview {
background: url("./shared/images/freedom.jpg") left 15% top 20%/cover no-repeat padding-box border-box scroll;
width: 100vw;
height: 33vh;
position: relative;
}

Linear & Radial gradient - Example

.background {
background-image: linear-gradient(to bottom left, green, red);
background-image: linear-gradient(180deg, green, red, #fa923f, transparent);
background-image: linear-gradient(73deg, green 30%, red 60%, #fa923f, transparent);
}
warning
  • Linear and Radial Gradient will be considered as Image in background property.
  • Background property can have more than one Images (Gradient included), but there should be only one color.
  1. The background Property - mdn
  2. Styling Images - w3 schools
  3. Filters - mdn
  4. Styling SVG - mdn

CSS Filter

img {
/* <filter-function> values */
filter: blur(5px);
filter: brightness(0.4);
filter: contrast(200%);
filter: drop-shadow(16px 16px 20px blue);
filter: grayscale(50%);
filter: hue-rotate(90deg);
filter: invert(75%);
filter: opacity(25%);
filter: saturate(30%);
filter: sepia(60%);

/* Multiple filters */
filter: contrast(175%) brightness(3%);
filter: grayscale(80%) blur(5px);
filter: drop-shadow(3px 3px red) sepia(100%) drop-shadow(-3px -3px blue);

/* Use no filter */
filter: none;
}