To set a gradient background, you can use the background parameter. For a gradient border, you can use border-image-source.
Your request wasn’t very clear, but I assume you want to direct the endpoints of the four elements towards the center of the grid. In that case, I had to individually set the gradient for both the background and the border at each of the four elements to radiate in the desired direction.
You’ll have to play with the settings a bit to get exactly what you want, but here’s an example using image mask. I used mask because it can also cover a border on the component. I couldn’t get it to account for a box shadow however, and the transparency would also effect any content in the card. To avoid that you’d need to layer two elements.
An alternative is to use the transparent gradient for the card background and forget about mask altogether, but then it wouldn’t fade the border. I only saw a border on the first box and not the others, so not entirely sure what you wanted. Exactly as the image shows? You’d probably need to adjust each of the 4 boxes individually and likely need to wrap multiple elements together to get the exact appearance.
2
Answers
Can use
linear-gradient()
orradial-gradient
.To set a gradient background, you can use the
background
parameter. For a gradient border, you can useborder-image-source
.Your request wasn’t very clear, but I assume you want to direct the endpoints of the four elements towards the center of the grid. In that case, I had to individually set the gradient for both the background and the border at each of the four elements to radiate in the desired direction.
You’ll have to play with the settings a bit to get exactly what you want, but here’s an example using image mask. I used mask because it can also cover a border on the component. I couldn’t get it to account for a box shadow however, and the transparency would also effect any content in the card. To avoid that you’d need to layer two elements.
An alternative is to use the transparent gradient for the card background and forget about mask altogether, but then it wouldn’t fade the border. I only saw a border on the first box and not the others, so not entirely sure what you wanted. Exactly as the image shows? You’d probably need to adjust each of the 4 boxes individually and likely need to wrap multiple elements together to get the exact appearance.