You can do some pretty neat stuff once you understand that you can play with inheritance with this. However first let's understand something from this doc on background:
With CSS3, you can apply multiple backgrounds to elements. These are layered atop one another with the first background you provide on top and the last background listed in the back. Only the last background can include a background color.
So when one do:
background: red;
He is setting the background-color to red because red is the last value listed.
When one do:
background: linear-gradient(to right, grey 50%, yellow 2%) red;
Red is the background color once again BUT you will see a gradient.
.box{_x000D_
border-radius: 50%;_x000D_
width: 200px;_x000D_
height: 200px;_x000D_
background: linear-gradient(to right, grey 50%, yellow 2%) red;_x000D_
}_x000D_
_x000D_
.box::before{_x000D_
content: "";_x000D_
display: block;_x000D_
margin-left: 50%;_x000D_
height: 50%;_x000D_
border-radius: 0 100% 100% 0 / 50%;_x000D_
transform: translateX(70px) translateY(-26px) rotate(325deg);_x000D_
background: inherit;_x000D_
}
_x000D_
<div class="box">_x000D_
_x000D_
</div>
_x000D_
Now the same thing with background-color:
.box{_x000D_
border-radius: 50%;_x000D_
width: 200px;_x000D_
height: 200px;_x000D_
background: linear-gradient(to right, grey 50%, yellow 2%) red;_x000D_
}_x000D_
_x000D_
.box::before{_x000D_
content: "";_x000D_
display: block;_x000D_
margin-left: 50%;_x000D_
height: 50%;_x000D_
border-radius: 0 100% 100% 0 / 50%;_x000D_
transform: translateX(70px) translateY(-26px) rotate(325deg);_x000D_
background-color: inherit;_x000D_
}
_x000D_
<div class="box">_x000D_
_x000D_
</div>
_x000D_
The reason this happens is because when we are doing this :
background: linear-gradient(to right, grey 50%, yellow 2%) #red;
The last number sets the background-color.
Then in the before we are inheriting from background (then we get the gradient) or background color, then we get red.