What I am trying to do is to show both background-color and background-image, so that half of my div will cover the right shadow background image, and the other left part will cover the background color.
But when I use background-image, the color disappears.
It’s perfectly possible to use both a color and an image as background for an element.
You set the
background-colorandbackground-imagestyles. If the image is smaller than the element, you need to use thebackground-positionstyle to place it to the right, and to keep it from repeating and covering the entire background you use thebackground-repeatstyle:Or using the composite style
background:If you use the composite style
backgroundto set both separately, only the last one will be used, that’s one possible reason why your color is not visible:There is no way to specifically limit the background image to cover only part of the element, so you have to make sure that the image is smaller than the element, or that it has any transparent areas, for the background color to be visible.